Record count while Looping and branching

I have folowing Senario:
I’m looping a recordset of 10 records,
Then branching it into 2 categories based on some criteria and finally writing them into two different recordsets.
…my question is is there any way of putting record Num to each record under a record set .
i.e if the main recordset has 10 record and first child recorset has 3 records then records in first child set shld have num 1,2,3 and in second it shld be 1,2,3,4,5,6,7.
I dont want to loop agian on the child recordsets once they the done to put the recordnum(using $iteration value).

is there any other way out…i.e to store value somewhere and keep on adding 1 when we write into child record set ? .

Use the pub.math:addInts service to keep on adding1(ie to store the value) and this logic should be inside the loop…


is there any way to keep the variable value, when u enter the loop again…because every time loop iterates …the value is getting initilized.
so is there any way to declare the variable which will behave like $iteration variable…i.e keeping the old value


I've attached a simple skeleton package that demonstrates the behavior you are requesting.  It uses very simple record structures (with members data and number) it uses data to decide which sub-list the record should be placed in and it updates number to count up from 1 independently for each sub-list.  If you have any questions just post them and I'll help you where I can.

ListSeparator (8.3 k)