Thursday, 22 April 2010

AX - MultiSelectionHelper

Today I learned a new class which I think is great.
The MultiSelectionHelper class provides an interface to work with multiple selected records on a form data source. Say you want to highlight a number of records and run a function against them.
Here is some sample code:
public void initFromArgs(Args _args = this.parmArgs())
    MultiSelectionHelper    multiSelectionHelper;
    PurchReqTable           purchReqTable;

    if (args && args.caller() && args.record())
        multiSelectionHelper = MultiSelectionHelper::createFromCaller(args.caller());

        multiSelectionHelper.createQueryRanges(queryRun.query().dataSourceTable(tablenum(PurchReqTable)), fieldstr(PurchReqTable, PurchReqId));

            case tablenum(PurchReqTable) :
                purchReqTable= multiSelectionHelper.getFirst();
                while (purchReqTable)

                    purchReqTable = multiSelectionHelper.getNext();

No comments: