Add a Loop
You can loop through documents within a folder or items within a list in a data object using the Loop node in your workflow.
You can map individual fields (supported within TotalAgility Studio) or use object-level mapping to return all data for the instance found without the need to map all the individual return fields. Then, create a task for each item found and not found.
When you add a Loop node, the following elements are included:
-
Index and row found variables are automatically created and mapped.
-
Decision for the row found is added with true path and false path.
-
True path is linked to the task when an item is found and then looped back to the Loop node.
-
False path is linked to the task when there are no more items.
Procedure
-
On the
Workflow tab, select
below the Start node.
The Add activity dialog box is displayed.
- On the Type list, select Loop. (Default: Task)
- By default, "Loop" appears as the Title. You can change the title as needed.
-
On the
Data object list, select a data object variable from an existing list.
Alternatively, create a new variable if the required variable is not available by selecting and in the New dialog box, create the variable as needed. When creating the variables, include "Loop" in the variable names for easier identification of the variable during mapping. For example, LoopIndex and LoopRowFound. See Create variables for more information.
-
To specify whether to return data only for the mapped fields or all data for the instance found, select either option
for
Return:
-
Field(s) (default): The list of fields from the selected data object is displayed in the table. Map the fields to the corresponding variables to return the data for the mapped fields.
-
Object: Map the data object variable to return all data for the instance found.
If the required variable is not available, you can create a new variable using .
-
-
Specify the task to perform when an item is found, in the
Item found go to perform the following steps:
- On the Type list, select Task.
- In the Name field, a default name for the activity appears. You can modify the name as needed.
- Optional. Enter a Description for the node, such as "When cost is > 500".
-
Specify the task to perform when no more items are found, in the
Go to when no more items found perform the following steps:
- On the Type list, select Task.
- In the Name field, a default name for the activity appears. You can modify the name as needed.
- Optional. Enter a Description for the node, such as "When cost is < 500."
-
Select
Add.
If you remove a Loop node, the system removes any unused variables within the node.