FOREACH Workflows
These workflows represent loops, that is, they repeat one or more tasks several times depending on the defined loop conditions.
This topic provides information on the following:
- Overview
- Defining the Loop Condition
- Adding Tasks
- Linking Tasks
- Deleting Tasks
- Moving Tasks
- Modifying at Runtime Not Possible
ForEach workflows process tasks multiple times and therefore, they represent a loop. You must specify the number of loop iterations that will take place and the tasks that should be repeated. These Workflows can contain any executable object except Schedules (JSCH). It is also possible to embed other ForEach Workflows in them.
The Workflow page contains by default a predetermined loop construction to which you can add tasks. This construction comprises a START node in which you can define the loop and an END node which will be processed when the loop has been ended.
The tasks that should be repeated must be assigned to the loop line (this is the line that goes from and to the START node). They will automatically be linked and arranged in sequential order. For more complex structures, you can create subordinate workflows.
The tasks will only be processed when the loop condition has been evaluated; you define the condition on the START node, see Defining the Loop Condition.
To have the preconditions of the individual tasks of a ForEach workflow evaluated in each loop iteration, make sure that they are set to Repeat Processing in each task, see Building (Right) Pane.
If the loop definition does not result in a loop cycle, the END node is immediately processed. The tasks are skipped and obtain the UNPROCESSED status within the workflow. In this case no tasks are created.
The content of the Process page is processed exactly once. The number of loop iterations is irrelevant.
To Create a ForEach Workflow
- In the Process Assembly perspective open the Explorer.
- Click the Add Object button on the toolbar or right-click anywhere in the list and select Add Object to open the list of available object types.
- Expand the Workflow (JOBP) node and select FOREACH Workflow.
- On the Object Name dialog enter a descriptive name and, optionally, a title that help you later recognize the Workflow. Click OK.
- The Workflow is created immediately displaying a predefined loop design. You can start defining its loop conditions, adding tasks, etc.
The tasks in a ForEach Workflow are processed after its loop conditions have been evaluated. They are defined in the Start node.
To Define the Loop Conditions
-
Open the properties of the Start node. To do so, do one of the following:
- Right-click on Start and select Properties from the popup menu.
- Select Start and click the Properties button on the toolbar.
The properties pane is displayed at the bottom half of your screen.
-
Open the For Each tab.
-
Define the loop conditions:
Iteration Source Description Variable object The VARA object is used as the source for the number of loop iterations.
The ForEach task chain is processed once for each column entry of a Variable object.
If the column or variable does not include an entry, the START object is in EMPTY status . The tasks are skipped and obtain the UNPROCESSED status within the workflow. This means that neither tasks are created nor RunIDs are assigned.
If the variable cannot be accessed because its agent is not available, the workflow switches to "Waiting for Agent" status.
Prompt Set/Script array An array is used as the source.
The task is processed once per element (value) of the specified array.
You can create arrays using either PromptSet objects (use the elements checkbox and checklist) or a script.
Name Name of the variable object or array, depending on the selected source.
For variables: You cannot limit the selection to a variable type.
For arrays: It must be specified without a leading & character. You can use empty index brackets [].
Column Available only if the source is a variable object.
Column of the selected Variable object. Specifying a value is mandatory.
The value 0 must not be used here. If you do so, the system changes it to 1.
Specifying column 1 has the effect that the Key column (in static VARA objects) or the result column (in dynamic variables) will be used.
Publish Value as The name of the Variable object that is used to provide the source value to the workflow.
Depending on the source this will be either the entry of the Variable object or the value of the array that is currently used and complies with the loop cycle.
Since the object variable is passed on to the workflow, it can be used within the workflow tasks.
Requirements: The Inherit from Parent setting must be activated in the objects. It is not possible to use this value to change the alias of a task in the workflow.
- Start adding tasks to the Workflow.
To add a task to a ForEach workflow you drag and drop one or several objects from the Objects pane to the editor. They can be added to the loop line only.
The length of the loop line changes dynamically as you add tasks.
Links cannot be linked manually. They are linked to each other automatically when they are added. This is why the connector lines are not available here.
You can delete tasks in the same way as for other workflows. However, the connector lines in ForEach Workflows are predefined and cannot be deleted.
You can change the order in which the tasks are arranged along the loop line as you like. However, the tasks that are included in a branch can only be arranged in sequential order.
To create more complex structures you must embed workflows.
Modifying at Runtime Not Possible
Whereas the properties of STANDARD Workflows can be modified at runtime, the properties of FOREACH Workflows cannot. This is the reason why the button on the toolbar is always disabled. However, you can perform certain functions on the tasks inserted in a FOREACH Workflow, such as set a breakpoint, cancel, restart, etc. Which functions are available depends on the status and on the type of the task.
For information on which functions are available see Available Functions Depending on the Task Status.
See also: