Hi Everyone,
I want to get the Max of Field of two Aggregate Fields in my View. I am trying to do it through computed column but can't figure out the way to get the Max Aggregate Fields of my view in the View Method. So, I have two questions:
How to reference the Aggregate View Fields in View Method?
What's the best way to get the Max of two View Aggregate Fields other than View Method?
Note: View's query already has a Group By.
Thanks.
Thanks goshoom .
Yes, I was writing SQL before I started implementing in X++, what I was trying to do was to reference the Already Aggregated fields of the views but your method also works in my case.
Thanks again.
A computed column method is a method generating a piece of T-SQL code. Therefore you need to decide what SQL code you want to generate before you start writing X code for it. Have you done that?
The easiest way would be using GREATEST() function, but while it should work in Azure SQL, you would have a problem in Tier1 environments, if they aren't on SQL Server 2022.
What you could do instead is using select from values. For example:
(select max(n) from (values (max(num1)), (max(Num2))) as t(n))
Use the example to prepare SQL for your particular situation and test it before writing X code for it,
André Arnaud de Cal...
292,111
Super User 2025 Season 1
Martin Dráb
230,934
Most Valuable Professional
nmaenpaa
101,156