The loopdataarray statement is used at the beginning of a loop that loops over the elements of a data array.
This statement has three parameters:
array – is the data array to be scanned.
element – is the name of a field or variable where each array element will be stored. If this field or variable does not already exist it will be created as a local variable.
index – 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. (Note: This parameter is optional – if you don’t need to know the loop count, you can leave this parameter off.
The loopdataarray statement is used at the beginning of a loop that iterates over a data array (see Data Arrays and Loop for more information on these topics). LoopDataArray loops are always terminated with an endloop statement.
When the loop starts, Panorama calculates the data array and makes a copy of it. Each time through the loop Panorama extracts the next element from the array for processing. In other words, the first time through the loop the first element is processed, then the next time through the second element is processed, etc. The loop repeats until all of the array elements have been processed.
Here is a simple example that loops once for each item in the Stuff data array, and displays the item.
loopdataarray Stuff,item message item endloop
Adding a third parameter to the loopdataarray statement allows you to access the number of times the loop has repeated so far.
loopdataarray Stuff,item,itemnumber message itemnumber+": "+item endloop
Note: If the data array is empty, the statements in the loop are skipped without even executing them once.
LOOP without ENDLOOP – Each FOR statement must be paired with a corresponding ENDLOOP, UNTIL or WHILE statement. If this error message appears, the necessary statement terminating the loop has not been included.
LOOPDATAARRAY element parameter must be a field or variable – The ELEMENT parameter must be a field or variable, it cannot be a more complex calculation.
LOOPDATAARRAY index parameter must be a field or variable – The INDEX parameter must be a field or variable, it cannot be a more complex calculation.
|10.0||New||New in this version|