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 …
}

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