Loops through the rows of the dataset specified. With each successive loop a series of steps are executed and the current row of the dataset is incremented. The loop ends when it reaches the end of the dataset or when a Break is encountered. Commonly used to loop a block of steps through the records (rows) in a dataset (which is a multi-column, multi-row variable). With each loop the current record (row) in the dataset is incremented until the last record is reached, at which point the loop ends.
Declaration
<AMLOOP TYPE="DATASET" DATASET="text" FROM="number" TO="number" SORT="text(options)" SORTEDCOLUMN="text">
See Also: Loop, End Loop, Loop Array, Loop Files, Loop Expression, Loop Dataset, Loop List, Loop List Control, Loop Tree Control, Loop Windows, About Datasets
To set Loop Dataset properties
In the Available Actions pane, open the Loop folder and double-click the Loop Dataset action or drag it into the Steps pane.
In the Dataset name box, select the dataset.
If you want to specify a series of rows to be looped, select Optional parameters, and enter a start row and an end row. If this is not selected all rows are looped.
If you want to loop the records in an alphabetical sort order other than what exists in the dataset, click the Advanced tab and enter the properties as follows:
In the Output list box, select the sort order.
In the Column to sort on box, select the column of the dataset to use.
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 |
Dataset Name |
Text |
Yes |
(Empty) |
DATASET="datasetname" |
The name of a previously created dataset in which to loop through. Example actions that create a dataset are SQL Query, Get E-mail, Stored Procedure and Excel Cells to Dataset. About Datasets |
Start Row |
Text |
No |
(Empty) |
FROM="20" |
The record (row) to start on when looping through the dataset. |
End Row |
Text |
No |
(Empty) |
TO="82" |
The record (row) to stop on when moving through the dataset. If omitted or set to 0, the End Row is set to the last row in the dataset. |
Property |
Type |
Required |
Default |
Markup |
Description |
Output List |
Text (options) |
No |
None |
DATASET="datasetname" |
Specifies whether a sort order should be applied to the dataset values before the loop begins. If using this action with a SQL Query action, in most cases it will be more efficient to perform the sorting as part of the query instead of using this option. If ascending or descending is specified, a valid column name to sort on must also be specified. The available options are:
|
Sort on Column |
Text |
No |
(Empty) |
SORTEDCOLUMN="LastName" |
The dataset column to sort on. This parameter is active only if the Output List parameter selected is Sort the list in ascending/descending alphabetical order. |
The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.
More on setting custom step description
The Error Causes tab properties allow you to instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.
The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.
More about On Error properties
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.