AugForums.com

An Acumatica User Group

  • Free
    • Start Here
    • Rolodex
    • Podcast
    • Blog
    • Forums
  • Paid
    • AugSQL
    • GI Course
    • GI Library
    • Consulting
  • Register
Acumatica Forums

By using this website, you agree to our Terms of Use (click here)

Forums
AUG Forums
Acumatica Generic I...
Default Sorting on ...
 
Notifications
Clear all

#AcumaticaTnT Default Sorting on Aggregate Results

 
Acumatica Generic Inquiries & Pivot Tables
Last Post by Jeffrey Patch 4 years ago
3 Posts
3 Users
2 Reactions
2,994 Views
RSS
Tim Rodman
Posts: 3193
 Tim Rodman
Admin
Topic starter
May 17, 2021 3:02 pm
(@timrodman)
Famed Member
Joined: 10 years ago

If you create a Generic Inquiry in Acumatica and group, you can get summarized values like totals. But what if you want to sort based on the aggregate values?

I had this scenario today where I wanted to look at all Invoice Lines for the last year, group by Item, view the total quantity sold, and have the rows sorted by the highest total quantity sold on the top.

In this case, the Generic Inquiry was smarter than I expected it to be.

I tried the following in Acumatica 2020 R1 (20.114.0020).

 

I had these columns on the RESULTS GRID tab of the Generic Inquiry (SM208000) screen:

image

 

I was grouping by one field on the GROUPING tab of the Generic Inquiry (SM208000) screen:

image

 

The results looked like this:

image

 

As you can see in the previous screenshot, the data isn't sorted on the Qty Purch last 12 Months column. I could click on the Qty Purch Last 12 Months column and sort in Descending order to get what I wanted, but that would be an on-the-fly sort which is only for my user and which isn't remembered the next time I open the screen.

I wanted it to be sorted on the Qty Purch Last 12 Months column in Descending order by default for all users every time they open the screen.

 

On the SORT ORDER tab, I tried sorting by the =Sum([ARTran.Qty]) aggregate value which made sense to me:

image

 

But I got this error message when trying to run the Generic Inquiry:

Cannot perform an aggregate function on an expression containing an aggregate or a subquery.
image

 

Then I tried sorting on the field name only, not really expecting it to work:

image

 

But it worked!

image

 

The Generic Inquiry was smarter than I expected it to be because it sorted on the aggregate values even though I didn't tell it to.

 

Checking the Trace on the Generic Inquiry and looking at the SQL code, you can see that Acumatica automatically wrapped the field in the SUM formula. Somehow it was smart enough to do that:

image

 

 

Good job Acumatica!


2 Replies
davidhunter
Posts: 12
 davidhunter
May 17, 2021 7:24 pm
(@davidhunter)
Active Member
Joined: 4 years ago

Thank you for posting, that is a nice feature


Reply
Tim Rodman reacted
Jeffrey Patch
Posts: 38
 Jeffrey Patch
May 17, 2021 7:49 pm
(@jeffrey-patch)
Trusted Member
Joined: 5 years ago

Good one Tim


Reply
Tim Rodman reacted
Forum Jump:
  Previous Topic
Next Topic  
Forum Information
Recent Posts
Unread Posts
Tags
  • 12 Forums
  • 2,526 Topics
  • 10.9 K Posts
  • 33 Online
  • 2,324 Members
Our newest member: Michael Kiley
Latest Post: Pick List report suddenly not splitting on Shipment
Forum Icons: Forum contains no unread posts Forum contains unread posts
Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed

Online Members

 No online members at the moment

Acumatica Forums

Terms of Use & Disclaimers :: Privacy Policy

Copyright © 2025 · AUG Forums, LLC. All rights reserved. This website is not owned, affiliated with, or endorsed by Acumatica, Inc.

‹›×

    ‹›×