I wouldn't use a repeating field for this. A variable with repetitions or a return separated list of ID's in a variable would seem to be all that you need to have your list of ID's. If you are using fileMaker 13, there's a new summary field that can easily produce this return separated list of ID's from a found set of the same.
But I can't parse all the details of exactly what you are trying to accomplish with your script and how often you might run this script (since personnel changes can happen at any time...)
Thanks for this idea! This script would be run basically once a year, or at most every 3 months. I've luckily built a field already that has return separated the list of employees per duty. So now how do I get the entire list into a variable, and then tell the variable which line to choose from? So far it only enters the first line. (That's why I was thinking of working with repetitions in a field, rather than just lines) I've included a screen shot of what I have so far. This is before integrating your suggestion, which I'll need to look into today.
Actually, I just figured out a slightly more elegant way of doing this, rather than using variables, lists, etc. Here's a screenshot of it.
Basically, I told it to first filter the records on my list of employees by who was assigned as a supervisor. Then to GetNthRecord (EmployeeNumber ; $Stage) based on what stage of the cycle it's on, and repeat. There's also a line in there to help it recognize that the first 'N' records aren't necessarily the records I'm looking for, so it should skip to the next one that is. I've run it a couple times now, and it works beautifully.
Thanks Phil for the idea to look at something other than repeating fields for the answer!