Loop puzzle

This is one of my first loops, can’t get to first base.

var count = foundset.getSize(); // = 7
for(i=1; i <= count; i++)
{
	controller.recordIndex(i);
	application.output('serial = ' + company_join_people_id);
	application.output('peoid = ' + cpj_peo_id);
}

WITH the line “controller.recordIndex(i);” I get the error message “1 is not a function”.
Without it no error but the serial for the first record is repeated 7 times.

Morley, don’t know which version you use but this is the one for 2.1:```
controller.setSelectedIndex(i)


if I am correct, but to be honest I forgot, in your example you should do:```
controller.recordIndex = i;

But hey, pull the sample code out in the method editor and you know what it should be…

Hi Morley,

I think that you may need to use the following :

controller.setSelectedIndex(i)

This should move you to the record index returned by ‘i’ within your loop

Cheers
Harry

Thanks Harry & Marcel

controller.setSelectedIndex(i) it is.