Newbie confused - getFoundSetUpdater

I’m a newbie in programming (not just in Servoy) and I’m pretty sure this is a stupid question but I can’t seem be sure about this. So i’m asking for some help.

I’m using a code sample found in the docs for getFoundSetUpdater:

//safely loops through the foundset, starting with the selected row
controller.setSelectedIndex(1);
var count = 0;
var fsUpdater = databaseManager.getFoundSetUpdater(foundset);
while(fsUpdater.next())
{
fsUpdater.setColumn('my_flag',count++);
}

Playing with this snippet I found out that:
1 - If I don’t setSelectedIndex(x) to 1 but to some other index say 20, the returned fsUpdater will only include records from index 20 to the end.
2 - Because I’m updating ‘myflag’ field to numbers starting from 1, then fsUpdater.next() method moves a “foundset kind of record pointer” so that the next turn int the while loop sets ‘myflag’ of the next record.
3) - The snippet works as advertised and I get all of my records numbered from 1 to 830!

But this is is strange :?: because if according to 1) the fsUpdater includes the first record and according to 2) when the first line of the while loop when fsUpdater.next() is evaluated the “foundset kind of record pointer” should be refering the 2 record of the found set (not the first)!

The only way I can explain this behaviour is considering that although the evaluation of fsUpdater.next() returns true. This method does not iterate over the fsUpdater object. The iteration happens when and only when the setColumn() method is run positioning the object on the next row!

This would mean that 2) is incorrect! And would be correct if stated:
"2) - Because I’m updating ‘myflag’ field to numbers starting from 1, then fsUpdater.setColumn() method moves a “foundset kind of record pointer” so that the next turn in the while loop sets ‘myflag’ of the next record.

I’ve tried find this in the docs, but was unsuccessful. Is this conclusion correct?

Txs for taking the time,
mjekl

Looking closer at the docs I see that:

boolean next() Go to the next record in this updater, returns true if successful

This means that I’m wrong and that the snippet:

//safely loops through the foundset, starting with the selected row
controller.setSelectedIndex(1);
var count = 0;
var fsUpdater = databaseManager.getFoundSetUpdater(foundset);
while(fsUpdater.next())
{
fsUpdater.setColumn('my_flag',count++);
}

Is incongruent with .next() moving to the next record!
What am I missing here?

best,
mjekl

Is this a bug?

Sure I’m a newbie but in my view either fsUpdater.next() doesn’t evaluate in the first evaluation of the while() loop or this is a bug.

What am I missing if anything?

txs,
mjekl