AX2012 循环读取DataSource的记录
static void LoopFormDataSource(Args _args) { FormDataSource formDataSource; SalesLine salesLineSel, salesLineCur; ; formDataSource = salesLineCur.dataSource(); // 1 for (salesLineSel = formDataSource.getFirst() ? formDataSource.getFirst() : formDataSource.cursor(); salesLineSel; salesLineSel = formDataSource.getNext()) { // handle info(strFmt("%1", salesLineSel.RecId)); } // 2 salesLineSel = formDataSource.getFirst() as SalesLine; if (salesLineSel) { while (salesLineSel) { info(strFmt("%1", salesLineSel.RecId)); } } }