hljs.configure({cssSelector: "code"}); hljs.highlightAll();

Thursday, January 28, 2021

Avoid Duplicates In LookUp In Ax/D365Fo

Static void Job1()

   Query query = new Query();

    QueryBuildDataSource qbds1;

    QueryBuildRange qbr;

    SysTableLookup sysTableLookup;

    sysTableLookup = sysTableLookup::newParameters(tablenum(InventTable),this);

    sysTableLookup.addLookupfield(fieldnum(InventTable,ItemId));

    sysTableLookup.addLookupfield(fieldNum(InventTable,ItemId)); 

    qbds1 = query.addDataSource(tableNum(InventTable));

    qbds1.addGroupByField(fieldNum(InventTable,ItemId));

    qbds1.orderMode(OrderMode::GroupBy);

    sysTableLookup.parmQuery(query);

    sysTableLookup.parmUseLookupValue(False);

    sysTableLookup.performFormLookup();

}

No comments:

Post a Comment