The loop exits when $i = 52. This extent happens right after the Exit Loop If step produced a result = true.
If Replace Fields Contents was placed after Exit Loop If, it won't be executed if result (Exit Loop If) = true.
IMHO you should generally pick a strategy, from
1) WHILE condition DO ..... END WHILE
2) REPEAT ..... UNTIL condition
If you prefer the WHILE one, like your script is showing (and like I do, because I like to see immediately when the enchilada will stop while reading top to bottom), then the condition has to be modified accordingly.
($i > 52 in your case)
Bruce: Thanks. Commit after the loop but before 'replace....'
May I ask the 'mechanics'?
After the loop, for sure.
Record 51 isn't committed.
Setting the field opens the record.
In my brief tests, it looks like replacing field contents does not open the record; or at least, leave all records committed afterwards.
(update) For example - as a test - place a revert record /no dialog statement after the loop.
Record 51 will disappear.
In other words, records 1-50 committed after each subsequent record creation, but the 51st was created but uncommitted until the 'end if', but after I'd already issued another command. The latter got carried out on the 50 records, the 51st was still hanging so left blank.
Assuming that's right, it makes sense, thanks.