Skip to main content
Solved

Trying to sort by grouping in a GI

  • April 22, 2021
  • 5 replies
  • 430 views

wfilipiak67
Captain II
Forum|alt.badge.img+3

Hi, 

I am trying to do a GI get Month-To-Date, Year-To-Dae & Prior-Year Sales totals for an inventory item. 
There are multiple warhouses setup. 
I am using the INTran table, with a condition of the item & the TranType of Invoice. 

If I sort the results in Site Order (SIteID), the results do show in Site order. 
However, if I set the grouping to be by SiteID, results are totaled correctly by do not appear in Site Order.
Is there a way to sort by the grouping conditions?

No grouping:

With Grouping:

 




 

 

Best answer by Naveen Boga

Hi @wfilipiak67  I have done slight modifications to your Generic Inquiry and grouping is working as expected. Attached GI here, please verify.

5 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • April 22, 2021

Hi @wfilipiak67 If possible, can you please share the above Generic Inquiry?

 


wfilipiak67
Captain II
Forum|alt.badge.img+3
  • Author
  • Captain II
  • April 22, 2021

Here is the XML of the Inquiry. 
It has the Grouping checked

Thank you for any assistance.


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • Answer
  • April 22, 2021

Hi @wfilipiak67  I have done slight modifications to your Generic Inquiry and grouping is working as expected. Attached GI here, please verify.


lauraj46
Captain II
Forum|alt.badge.img+8
  • Captain II
  • April 22, 2021

Hi @wfilipiak67 ,

Although the INTran data access class is configured to display the SiteCD when you add the SiteID to the result grid, your GI is actually sorting based on the SiteID field.  You can see this by looking at the SQL trace after viewing the GI.  I would suggest that you add the INSite DAC and sort on the SiteCD, which it looks like is what @Naveen B has already done in his revised XML :)

...
WHERE ( [INTran].[CompanyID] = 2) AND  ( [INTran].[BranchID] IS NULL  OR [INTran].[BranchID] IN ( 22, 16, 20, 17, 21)) AND ( [INTran].[InventoryID] = @P0 AND [INTran].[TranType] = 'INV')
GROUP BY [INTran].[SiteID]
ORDER BY [INTran].[SiteID] OPTION(OPTIMIZE FOR UNKNOWN)


wfilipiak67
Captain II
Forum|alt.badge.img+3
  • Author
  • Captain II
  • April 22, 2021

Thank you both! 
That worked great!