Add a display field to a form. Sum of all amounts of filtered records.


i have a form in ax 2012.

I want to add a display field outside the grid with the sum of the amounts of the records i get

with my filters.

I dont know where to put the code for this. I can do it for marked records, but not for all the records

i see in the grid. Any help?

thank you in advance

Get the form query (by calling queryRun().query() on the main data source), copy it (by passing the query as parameter to Query’s constructor) and add SUM aggregation method for the field you want. Then run the query with a new QueryRun instance and obtain the result as usual.