Loop Array Action

Declaration

<AMLOOP TYPE="ARRAY" ARRAY="Text" RESULTVARIABLE="Text" DIRECTION="Text" DATASET="Text">

See Also

Loop Array Action-Setting Properties Loop, End Loop,  Loop Expression, Loop Dataset, Loop List, Break

Description

Loops through an AutoMate array, populating the specified AutoMate variable with the current element.

Supports looping the array “horizontally” (row by row, column by column) or “vertically” (column by column, row by row). Supports any size array of any dimensions.

Optionally populates a dataset with the array name and current index.

Practical Usage

To perform an action on each element of data in an array.

Parameters

General Tab

Array Name

Text, Required
MARKUP: ARRAY="myarray"

Specifies 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, Required
MARKUP: RESULTVARIABLE="varname"

Specifies an already-created 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, Optional
MARKUP: DATASET="ArrayIndexDS"

Specifies the name of a dataset to be created and populated with the current index.

Ordering

Text, Optional - Default horizontal
MARKUP: DIRECTION="vertical"

Specifies the direction of looping.

Options are:
 

Notes

Custom Description

This action includes the Description tab for entering a custom step description.

More on setting custom step description

Standard Error Handling Options

This action also includes the standard Error Causes and On Error failure handling options/tabs.

More on Error Handling Options

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.

More on variables
More on expressions

More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

<AMLOOP TYPE="ARRAY" ARRAY="myarray" RESULTVARIABLE="ArrayElement" DIRECTION="vertical" DATASET="ArrayIndexDS">