Sum of filtered records on a form

Hi Guys,

Is that possible to get to the set of records that had been filtered using combination of ranges and filters on the form? Actually, what i need is to have some buffer with the set of records that are currently visible on the form grid. Is there any way to achieve this or is there any axample in AX?

There is an example:

I have a form that shows let’s say various items on the grid each item has number of columns and some price.

Now, a user clicks a button and some records are filtered out (using query ranges). The user is still sees too many records that he doesn’ want to. So, he sets 10 various filters on the gird and finaly has 5 desired records shown on the grid.

At this point he also wants to see the total cost of those 5 items that he filtered.

Many thanx.

Well it seems I found a solution:

CustTable ct;

ct = custTable_ds.getFirst();

while (ct)
ct = custTable_ds.getNext();

/your code goes here/

You can do that by using SysQuery::packRangeAndSortOrder(Query _query) - it returns a container that you can send by a parm method to a class. Then, inside the class, use SysQuery::unpackRangeAndSortOrder(Query _query, container _pack) - _query is your local class query and _pack is the container mentioned earlier. After running this method, your query will be restricted by the ranges and sort orders packed in the container. Remember to run executeQuery() method afterwards.

Hope that helps. Regards.

Hmm… I thought that you needed communication between objects. If you’re running everything on the same object, I think that your code will work just as well.


thanx much for the reply. This will definitely come handy!