You can only retrieve 1, 10, 100, 1000 records from a select statement using firstonly syntax (like shown below)
while select firstonly100 rent order by PostedDate desc where (rent.PostedDate > td && rent.RentalOrderStatus == z_RentalOrderStatus::Posted) || rent.RentalOrderStatus == z_RentalOrderStatus::Approved { info("orders"); }
If you want to get different number of rows you can implement a counter in the while statement and force the code to stop as it reaches a prefixed limit value like show in code below.
int counter;
int limit = 5;
CustTable custTable;
while select custTable
order by custTable.AccountNum
{
counter++;
if(counter>=limit) break;
}