Sunday, July 3, 2016

QueryRun.changed in ax 2012

//queryRun.changed in ax 2012
Example :
1) CustTable
2) SalesTable
    Query                   query;
    QueryBuildDataSource    datasource;
    QueryRun                queryRun;
    int                     i= 0,
    ;
    query = new Query();
    datasource = query.addDataSource(tableNum(CustTable));
    datasource = datasource.addDataSource(tableNum(SalesTable));
    datasource.joinMode(JoinMode::OuterJoin);
    datasource.relations(true);
    datasource.addLink(fieldNum(CustTable, AccountNum),fieldNum(SalesTable, CustAccount));
    queryRun = new QueryRun(query);
    while (queryRun.next())
    {
        if (queryRun.changed(tableNum(CustTable)))
            i++;
    }
queryRun.changed(tableNum(CustTable));
//Above line return only when Customer table selecting next record

No comments:

Post a Comment

Search hierarchy for a match (TableALLGroup) X++

  Table1 ppt;  select firstonly ppt  order ItemCode, ItemRelation, AccountCode, AccountRelation where      (ppt.ItemCode == TableGroupAll::T...