User Guide > Objects > Alphabetical Listing > ForEach Workflows

For Each Workflows

The object-specific Logic tab is only available in IF- and FOREACH-type workflows and its structure depends on the workflow type that is used. It can be used to define workflows and the dependencies and properties of their subordinate tasks. The following description explains the Logic tab's specific structure in ForEach-type workflows and other specific characteristics of ForEach workflows.

You determine the workflow type when you create the object.

The Logic tab is similar to the Workflow tab which is only available in standard-type workflows. All other tabs are the same for all workflow types.

The tasks of ForEach workflows have the same properties as the tasks of standard workflows. For a more detailed description, see Object Properties.

For information on how to adjust this tab's view, refer to the description of the Workflow tab.

General Information

ForEach workflows process certain tasks several times and therefore, they represent a loop. The user must specify the number of loop iterations that will take place and the tasks that should be repeated.

The Logic tab contains a predetermined loop construction to which you can add tasks. This construction is composed of a START object in which you can define the loop and an END object 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 runs from and to the START object).

ForEach workflows can include any executable object except for schedules and cockpits and they can also include other ForEach workflows.

Note that in ForEach workflows you can add tasks only to the loop line. They will automatically be linked and arranged in a serial order. This order must be kept and you cannot draw lines manually. For more complex structures, you can create subordinate workflows.

You cannot use external dependencies within ForEach workflows.

The tasks will only be processed when the loop condition has been evaluated. If the loop definition does not result in a loop cycle, the END object is immediately processed. The tasks are skipped and obtain the status UNPROCESSED within the workflow. No activities are created in this case.

The content of the workflow's Process tab is processed exactly once. The number of loop iterations is irrelevant.


Defining For Each Workflows

Defining Loop Conditions

To define loop conditions in ForEach workflows, open the properties of the START object and switch to the ForEach tab.

You can open the properties either using the context menu or via the symbol within the box.

The Earliest tabs in the START object and in the properties of all workflow tasks are the same.

The following settings and options are available in this tab:

Field / Option Description
Source Here you can select the source that should be used for the number of loop iterations.
Variable object

The VARA object is used as the source.

The ForEach task chain is processed once or each column entry of a Variable object.

If the column or variable does not include an entry, the START object obtains the status EMPTY. The tasks are skipped and obtain the status UNPROCESSED within the workflow. This includes that neither activities are created nor RunIDs are assigned.

If the variable cannot be accessed because its agent is not available, the workflow switches to the status "Waiting for Host".

  Name

The name of the Variable object.

You cannot limit the selection to a variable type.

  Column

Column of the selected Variable object.

The first value column is used if you do not specify a value in this field.

Note that you must not use the value 0. Specifying column 1 has the effect that the Key column (in static VARA objects) or the result column (in dynamic variables) will be used.

Prompt / Script Array

An array is used as the source.

The task is processed once per element (value) of the specified array.

You can either create arrays using PromptSet objects (use the elements checkbox and checklist) or using a script.

  Name

Name of the array.

The array must be specified without a leading & character and you must use empty index brackets [].

Publish Value The source's value is published using an object variable.
Publish value as

The name of the object variable that is used to provide the source value to the workflow. Depending on the source, this will either be the entry of the Variable object or the value of the array that is currently used and complies with the loop cycle.

Because the object variable is passed on the workflow, it can be used within the workflow tasks. Requirements: The setting "Inherit from Parent" must be activated in the objects.

It is not possible to use this value to change the alias of a task in the workflow.

Adding Tasks

To add a task to a ForEach workflow, drag and drop one or several objects from the Explorer to the relevant loop line of the open ForEach workflow.

Note that you cannot link tasks manually. Tasks will automatically be linked to each other when they are added. Therefore, the Line Tool is not available in the Logic tab.

The length of the loop line is dynamically adjusted to the number of tasks that are included.

Deleting Tasks

Select the tasks that should be deleted using the context-menu command Remove or hit the DEL key.

Note that the lines in ForEach workflows are predetermined and cannot be deleted.

Moving Tasks

You can change the order in which the tasks are arranged along the loop line as you like.

Note that the tasks that are included in a branch can only be arranged in a serial order. To create more complex structures, you can use sub-workflows.


Processing For Each Workflows

Display in the Activity Window

The Activity Window displays each repeated task.

The hierarchical view of the Activity Window displays each ForEach workflow as a container that includes all subordinate tasks that have run. Their order depends on the loop iterations.

Monitor View

The monitor of ForEach Worfklow always displays the current loop cycle.

Modifying Active For Each Workflows

The rules of modifying active workflows also apply to IF- and FOREACH-type workflows with the following limitations:

Forecast

For forecast calculations of ForEach workflows, the system uses the task chain's processing duration without iterations.

Restart

In restarts, the system reevaluates the number of loop cycles from the specified source. Therefore, the number of iterations can be different in each restart. In other words, a restart of ForEach workflows shows the same behavior as a regular start.