Loops through a array, populating the specified variable with the current element. This action supports looping the array “horizontally” (row by row, column by column) or “vertically” (column by column, row by row). It also supports any size array of any dimensions and can optionally populate a dataset with the array name and current index. Mainly used to perform an action on each element of data in an array.
Declaration
<AMLOOP TYPE="ARRAY" ARRAY="Text" RESULTVARIABLE="Text" DIRECTION="Text" DATASET="Text">
Example
<AMLOOP TYPE="ARRAY" ARRAY="myarray" RESULTVARIABLE="ArrayElement" DIRECTION="vertical" DATASET="ArrayIndexDS">
See Also: Loop, End Loop, Loop Files, Loop Windows, Loop Expression, Loop Dataset, Loop List, Loop List Control, Loop Tree Control
To set Loop Array properties
In the Available Actions pane, open the Loop folder and double-click the Loop Array action or drag it into the Steps pane.
In the Array name box, select the array to loop.
In the Populate variable with current element value box, select the variable to populate.
To populate a dataset with an array index, enter a name for the dataset in the Create and populate dataset with current indexes box. (Dataset names must be alphanumeric, begin with a letter, and contain no spaces.)
For a two-dimensional array, the dataset Dimension field is populated with either the column or row index depending on the selection made under Ordering (see below).
For a multi-dimensional array, under Ordering, select First dimension first to loop horizontally (dataset is populated with column index), or Last dimension first to loop vertically (dataset is populated with row index).
To set the Description tab properties, refer to Description Tab Options.
To set the Error Causes and On Error tab properties, refer to Step Error Handling.
When finished, click OK to save settings and close the properties dialog box.
To auto-indent after all steps are added
In the Steps pane, hold down SHIFT and click the first and last steps in the block so that the complete block of steps is selected.
Click Format .
Property |
Type |
Required |
Default |
Markup |
Description |
Array Name |
Text |
Yes |
(Empty) |
ARRAY="myarray" |
The name of the array to loop. The array must be created and populated in earlier steps using the Create Array action and the Set Variable action. |
Populate Variable with Current Element Value |
Text |
Yes |
(Empty) |
RESULTVARIABLE="varname" |
The variable that should be populated with the next data element on each successive loop. The variable must be created in an earlier step using the Create Variable action. |
Create and Populate Dataset with Current Indexes |
Text |
No |
(Empty) |
DATASET="ArrayIndex" |
The name of a dataset to be created and populated with the array name and current index. |
Ordering |
Number |
No |
Horizontal |
DIRECTION="vertical" |
The direction of the loop. The available options are:
|