Loop through record from data source [AX 2012]
1.Using a while loopsalesLine_ds = _salesLine.dataSource();
localSalesLine = salesLine_ds.getFirst(true) as SalesLine;
if (localSalesLine)
{
while (localSalesLine)
{
//Do your logic
localSalesLine = salesLine_ds.getNext() as SalesLine;
}
}
2.Using a for loop
salesLine_ds = _salesLine.dataSource();
for (localSalesLine = salesLine_ds.getFirst(true) ? salesLine_ds.getFirst(true) : salesLine_ds.cursor();
localSalesLine;
localSalesLine = salesLine_ds.getNext())
{
//your logic
}
No comments:
Post a Comment