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));
        }
    }
}

  

posted @ 2022-04-15 11:28  一口一个小馒头  阅读(44)  评论(0编辑  收藏  举报