Current Repeat Index
When an array variable in a procedure is going through its list, the user may want the pointer into the list (the index) that the array variable is currently using to be repeated. To do this, use the Current Repeat Index system variable:
The following example shows how to pull separate items from a group (a list) by the index. To follow along, download the files here:
1. Right click ‘lines’ and select Add Variable.
2. The Variable dialog box displays. Select OK to continue.
3. In the Project Window, right click the form and select Add Variable > By position. Enter ‘line1’ in the Name field and select OK.
4. Right click the ‘line1’ variable from the Project Window and select Add Pre-condition Procedure > Set Variable. Enter ‘GetByIndex1’ in the Name field. From the Use variable field, select the ‘lines’ variable created earlier. Select OK.
5. The Set Variable Action dialog box displays. Select ‘line1’ from the Variable drop-down menu. Select OK.
6. Right click the ‘GetByIndex1’ procedure and select Add AND Condition > Is equal to. The Data Condition dialog box displays. From the Of variable drop-down menu, select the Current Repeat Index system variable. In the field below ‘Is equal to’, enter a constant value of 1. Check the Compare as Numeric checkbox. Select OK to continue.
7. Repeat steps 3-6 as needed, adjusting the naming conventions as needed. The results can be viewed in the Variables Window.