if this is 1 order for iteration 1, 2 for iteration 2 etc then it's really easy
type the following
int intIteration;
intIteration = atoi(lr_eval_string("1"));
then highlight the 1 and right click - replace with a parameter
from the combo box, ParameterType select Iteration Number
you will now have the current iteration number in the variable intIteration and can use this for your loop
if you want to use the total number of iterations, then you'll need to do this manually I believe - unless you want to start looking for where the number of iterations is saved (and remember it's different if you're in the controller) and parse that file and extract it - probably easier to manually change the value!