example of queryrun in axapta
SysQueryRun queryRun = new SysQueryRun(querystr(MyQuery));
CustInvoiceJour custInvoiceJour;
CustInvoiceTrans custInvoiceTrans;
;
if (queryRun.prompt())
{
while (queryRun.next())
{
custInvoiceJour = queryRun.get(tableNum(CustInvoiceJour));
custInvoiceTrans = queryRun.get(tableNum(CustInvoiceTrans));
if (queryRun.changed(tableNum(CustInvoiceJour)))
{
info(strfmt("Account: %1", custInvoiceJour.invoiceAccount));
}
if (queryRun.changed(tableNum(CustInvoiceTrans)))
{
info(strfmt("Item: %1, Qty: %2, ",custInvoiceTrans.itemId, custInvoiceTrans.qty));
}
}
}