Solved

How to sort GI result with function formular

  • 19 October 2022
  • 6 replies
  • 135 views

Userlevel 2
Badge

Hi,

I have a question about GI result sorting. 

There is a system default GI AR-CustomerSummary, Screen ID AR0008DB, attached screen shot for the detailed GI setting. Currently the AR is grouped by customer account, and i would like the result to sort by “Balance” descending. 

The result seems to not showing the sorting as i expected, please take a look and let me know which part is doing wrongly.

 

Thank you.

 

 

icon

Best answer by RoyceLithgo 20 October 2022, 04:02

View original

6 replies

Userlevel 7
Badge +4

Hi @jay13! I think for this issue the sorting is not meant to accommodate an IIF statement, at least not that I’ve ever seen.

I would recommend in the expression to multiply by -1 instead of just adding a - to the value. I’m not sure if it makes a difference, but this is the most common way I’ve seen to invert the value.

It seems like the formula is just deciding on if to make it negative or not and not necessarily related to sorting, so I think it’s best to leave the formula on the results grid and just sort descending by the DocBal field.

Have you already tried something like this?

Userlevel 5
Badge +2

I used this for the Sorting formula and it worked as expected.

=IIf([ARInvoice.DocType] = 'CRM', -1, 1) * [ARInvoice.DocBal]

It’s the same formula I used for Balance Signed column above.

Userlevel 2
Badge

Hi @jay13! I think for this issue the sorting is not meant to accommodate an IIF statement, at least not that I’ve ever seen.

I would recommend in the expression to multiply by -1 instead of just adding a - to the value. I’m not sure if it makes a difference, but this is the most common way I’ve seen to invert the value.

It seems like the formula is just deciding on if to make it negative or not and not necessarily related to sorting, so I think it’s best to leave the formula on the results grid and just sort descending by the DocBal field.

Have you already tried something like this?

HI Benjamin,

Thank you for your reply.

I add a “TEST” column in the resulting grid, not sure whether this is what you mean, and i made the sorting by “ARInvoice.docBal” descending, most of the results are able to sort by order, but still have some records didtnt follow order, attached some screenshots.

 

Userlevel 2
Badge

I used this for the Sorting formula and it worked as expected.

=IIf([ARInvoice.DocType] = 'CRM', -1, 1) * [ARInvoice.DocBal]

It’s the same formula I used for Balance Signed column above.

Hi Royce,

Thanks for your reply.

I think your case is different from mine. Your case is sorting by individual invoice balance, but i grouped the document total by customers.

 

Userlevel 5
Badge +2

Was going to ask whether you’d grouped your query.

Unfortunately with grouping it’s not possible to do what you want. You need the Sort function to be aggregated by the groups as well but you can’t use aggregate functions in Sort. 

You’d need to rewrite this as a report with Report Designer.

Userlevel 2
Badge

Was going to ask whether you’d grouped your query.

Unfortunately with grouping it’s not possible to do what you want. You need the Sort function to be aggregated by the groups as well but you can’t use aggregate functions in Sort. 

You’d need to rewrite this as a report with Report Designer.

Hi Royce,

Alright, thank you again.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved