Tag: List
The action List
lets you add actions to a specified list whose entries will be iterated over using Loop
action.
<List name="MyList" Action="Load" Database="Mailtest.nsf" Server="ACME01/ACME"/>
Tag Attributes
Attributes | Attribute Value | Value Description | Comment |
Name | User definable string | The ID of the list | Mandatory – This ID is the only link to the list when calling it from a Loop. |
Action | Desired action name | Action to be performed | Mandatory |
Tag: Loop
The action Loop
will repeat a given block of actions over the individual lines in the specified List.
<loop list="MyList">
<If index="last">
<echo value="LOOP LAST"/>
</If>
<If index="first">
<echo value="LOOP FIRST"/>
</If>
</loop>
Tag Attributes
Attributes | Attribute Value | Value Description | Comment |
List | User definable | The name of the list to process | Mandatory – This is the only link to the list |
OnError | ExitLoop
Next | The action to take in case an error is encountered within the Loop block:
- "ExitLoop": will break out of the loop and continue with the script
- "Next": will continue on to the next loop item
| Not mandatory – see detailed description |
RemoveListItemOnError | Any
ListAction | Determines what action will trigger List action removal:
- All: Removal will be triggered by an error on action within the Loop block
- ListAction: Removal will only be triggered if an action within the List itself encounters an error.
| Not mandatory |
Tag: ExecuteListAction
The self-closing action ExecuteListAction
triggers the action in the current iteration of the Loop. This is mandatory; the action in the current List item will NOT be executed without this.
Note | When using the 'Execute Automation File on...' option found in multi-server and multi-database tools, it is not necessary to have the ExecuteListAction tag within the script being launched.
This will be taken care of automatically. |
Detailed Description
Even though setting the
OnError
attribute is not mandatory, this ensures that the action the script takes when encountering an error considers the Loop. If this is not set and an error is encountered, the global
OnError
behavior will be followed, resulting in the Loop being stopped.
Note | The Loop and List actions define the main elements involved in Loop operations. In addition to the given actions asked to be performed on each List line, there are sub-actions available to define how the Loop will interact with and, at times, modify the List it is working on. See below. |
Sub-Actions
Tag: Clear
The action Clear
lets you clear all content from a given List.
<Clear list="MyList"/>
Tag Attributes
Attributes | Attribute Value | Value Description | Comment |
List | User definable | The name of the list to be cleared | Mandatory |
Tag: ClearCurrentListItem
The self-closing action ClearCurrentListItem
lets you clear the action currently used in the list.
<If target="Tree" test="focusRoot" mode="equals" value="false">
</If>
Example Script
In the script above, the List
"MyList" is defined as 3 separate Load
actions, each on separate databases. A Loop
block is then initiated on "MyList". The Loop
will repeat all actions contained within on every entry in "MyList" one at a time. The loop-specific OnError
attribute is set as "Next"; if an error is encountered during the execution of the Loop
(e.g. an item is found to be missing) the Loop
will move on to the next action within the Loop
.