The loopindex statement allows a procedure to determine how many times a loop has been repeated.
Parameters
This statement has one parameter:variable – is the name of a field or variable where the loop count will be stored. If this field or variable does not already exist, it will be created as a local variable.
Description
Panorama keeps track of how many times the statements inside a loop have been executed. If your procedure needs to access this value, it can do so with the loopindex statement. In this example, ten new records are added to the database. Using the loopindex statement, the Num field in the new records will be assigned a number from 1 to 10 as the records are added.
loop
addrecord
loopindex Num
until 10
Note: If the specified field or variable does not exist, Panorama will automatically create a local variable for you. In the example below, a local variable named n is automatically created (assuming there is no field or global variable named n that has already been created).
loop
loopindex n
addrecord
until n>=10
Error Messages
LOOPINDEX must be used between LOOP and ENDLOOP statements – The loopindex statement can only be used inside a loop.
LOOPINDEX parameter must be a field or variable – The parameter supplied to the loopindex statement must be the name of a field or variable, it cannot contain any calculations or operators of any kind.
See Also
History
Version | Status | Notes |
10.0 | New | New in this version |