AnsweredAssumed Answered

Assign Group of Records in Found Set to an ID

Question asked by fmdataweb on Apr 18, 2018
Latest reply on Apr 19, 2018 by beverly

I have a found set of records and I need to loop through them and assign them a group ID number, whereby I divide the total number of found records by the total number of groups to work out how many 'batches' will be allocated to each group.


For example I have a found set of 180 records and I need to divide them into 9 different groups, so each batch of 20 records will be assigned into a different group. Records 1-20 will be in group 1, records 21-40 will be in group 2, and so on.


My script will look something like this:


Go to Record/Request/Page [ First ]



Set Field [ Products::GroupID ] <<-- not sure how to calculate the correct group ID here


Go to Record/Request/Page [ Next; Exit after last ]

End Loop


I'm trying to work out how to calculate as I go through the loop which group ID to assign but coming up blank - appreciate any tips here to dynamically calculate the group number for each record as it proceeds through the loop of found records.