Notifications
Announcements
No record found.
If I select first only order by recId desc...is it the same as select maxOf(RecId)
Or could the maxOf result in wrong result..I mean is order by recId desc more reliable?
It fetches the same value. Just note that you should use a field list if your don't use maxOf(), otherwise you would be fetching all fields instead of just RecId.
select firstOnly RecId from myTable order by RecId desc;
Because using maxOf() is shorter and it makes your intent more obvious, you should prefer it in this case.
Hi Martin,
Do u know why after using maxOf(RecId)
I can't access locator of DirPartyContactV3Entity..the recId is null as well
Yes, I know.
The only fields that will have a value are those that you either aggregate (RecId) or group by (Type and IsMobilePhone). No other fields has a value defined.
But I can't group by locator because the logic won't work in that case.
What I did is that I made a view with max electronic address RecId and group By Type,IsMobile and PartyNumber. The view contains (logistics electronic address, logistics location,dirPartyLocation and dirPartyTable) then in code I did a join of the view with logistics electronic address based on recId. Could I have done it without the view and by code? I mean can I edit the above code to make it work
I'm sorry, but I can't tell what code you should use instead of your code if all I know is the code. I don't know what you're trying to achieve. Most importantly, it's not clear why you're selecting the highest RecId.
If you want to keep the query as it is, then we there is no way how to edit your code to give you the extra field. It would require doing things differently.
Anyway, that's not related to the topic of this thread (Is maxOf(RecId) same as sort by order recId desc?). If you want to discuss this other topic, please create a new thread. And if you agree that "Is maxOf(RecId) same as sort by order recId desc?"has been answered, please verify the answer.
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 Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 660 Most Valuable Professional
André Arnaud de Cal... 549 Super User 2025 Season 2
Sohaib Cheema 307 User Group Leader