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.
goshoom can you help me with this please.
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,
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.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
CA Neeraj Kumar 2,028
André Arnaud de Cal... 878 Super User 2025 Season 2
Sohaib Cheema 579 User Group Leader