AX – D365FO – Advanced filtering in code X++ on Query object

So, you are creating the query programmatically (of course using the Query* classes), and you need a statement like select * from tableA where columnB = val1 or columnC = val2 just do it like:     QueryBuildDataSource    qbds;     QueryBuildRange             qbr;    str                                      range;     // initializing the query and the datasource(s) here; will go like qbds = … Continua a leggere AX – D365FO – Advanced filtering in code X++ on Query object

D365FO – AX – Looping through table buffer (QueryRun) multiple times

queryRun queryRun;query query = new query(); CustTable custTable;query.addDataSource(tablenum(CustTable)); while (queryRun.next()){ custTable = queryRun.get(tablenum(CustTable)); // do something with the buffer ...} queryRun.reset() while (queryRun.next()) // another loop process{ custTable = queryRun.get(tablenum(CustTable)); // do something other with the buffer ...}