In the ax there is a key word
firstOnly1000
Which can be used like
select firstonly1000 <ObjectName> where <where clause>
Is there a way how to make a select of the next 1000? I was thinking about using recid and
select firstonly1000 <ObjectName> where <where clause> && Recid > maxof(firstonly1000.Recid)
but in some Ax versions Recid can be lower than zero. Is there some reasonable general way to do this for all Ax versions?
I would say no. And if you're wanting to do some sort of pagination you can use a query object (see link) or something similar to the below X++, which is pretty much the common convention.
while select salesTable
{
i++;
if (i>1000)
break;
info(strFmt("%1: %2", i, salesTable.SalesId));
}
Or
// Less often used method below. Usually for a specific purpose.
select salesTable;
while (salesTable && i < 1000)
{
i++;
info(strFmt("%1: %2", i, salesTable.SalesId));
next salesTable;
}
I would think the simplest way to accomplish what you're trying with the RecId
would be to sort by RecId Asc
then just track the last RecId
that you selected instead of maxOf
. I'd think you may get poor performance though if you just arbitrarily did it on any table.