Downrecord does not work properly in a simple loop when other procedure windows are open
I created a simple loop procedure to number my records in a database file, in a field “NR” which is displayed in the datasheet and in various forms. I did not close the winddows I had open before running the procedure. The procedure is:
local countdown
selectall
countdown = info(“Selected”)
Field NR
FirstRecord
NR = 1
copycell
Loop
downrecord
NR = val(clipboard()) +1
clipboard() = val(clipboard()) + 1
copycell
until countdown = 0
SHOWFIELDS NR
FIRSTRECORD
When the procedure was run, it numbered EVERY THIRD RECORD with the next consecutive number, and when it reached the last record, it ran quickly through all the numbers it didn’t enter before in the last record field. The procedure works fine in Panorama 6. Similar loop procedures worked (or didn’t work) the same way in other fields, such as consecutive check numbers, etc.
I found that when I closed all windows except the datasheet, the procedure worked as planned.
Your example really has nothing to do with his code though. His statement was
Until countdown=0
not
Until countdown
The first condition is never satisfied in either version of Panorama, because countdown never changes its non-zero value. The second one would work in Panorama 6, but stop after one loop in Panorama X.