D365FFO – AX – QueryBuildDataSource SortOrder syntax

static void Cyborg3QueryBuild2(Args _args)
    Query   query;
    QueryRun    qr;
    QueryBuildDataSource    qbds;
    QueryBuildRange qbr;
    VendTable   vendTable;
    query = new query();
    qbds = query.addDataSource(tableNum(vendTable));
    qbr =   qbds.addRange(fieldNum(vendTable, VendGroup));   

//here is the line where I thought I could control the sort direction

    qbds.addSortField(fieldNum(vendTable, AccountNum),SortOrder::Ascending);
    qr = new QueryRun(query);
            vendTable = qr.get(tableNum(vendTable));
            info( vendTable.AccountNum);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s