I have a record with let's say 100 lines, that a user marks. I retrieve the record like this:
CurrPage.SETSELECTIONFILTER(recSelection);
recSelection.FINDSET;
Now, I want to copy 20 lines of the selection at a time into another record variable and pass that to a function.
How can i process a record in steps? something like this:
batchSize := 20;
currSize := 0;
totalSize := recSelection.COUNT;
totalProcessed := 0;
recSelection.FINDSET;
REPEAT
IF (currSize = 0) THEN BEGIN
tmpRec.INIT;
END;
// how can I add the current to the tmp?
// tmpRec.INSERT -> recSelection
currSize += 1;
totalProcessed += 1;
IF (currSize = batchSize) OR (totalProcessed = totalSize) THEN BEGIN
SomeHeavyFunction(tmpRec);
currSize := 0;
END;
UNTIL recSelection.NEXT = 0;
I got it to work by this:
(deleteall with temp records are always a bit scary for me :P), recTemp is a Temporary record