Add a Loop
You can loop through the documents within a folder or items within a list in a data object using the Loop node in your workflow.
You can either map individual fields (supported within Quick Apps) 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 added along with it:
-
Index and row found variables are auto-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.
-
Click
below the Start node or any other node.
The Add activity dialog box is displayed.
- On the Type list, select Loop. (Default:Task)
- By default, the Title is displayed as activity type. You can change the title as needed.
-
On the
Source list, select a folder or data object variable from the existing list.
-
If you select the Data object variable, 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 you select the folder variable, map the Document found field to a document variable to save the extracted data from the document.
If the required variable is not available, you can create a new variable using . When creating the variables, include "Loop" in the variable names for easier identification of the variables during mapping. For example, LoopIndex and LoopRowFound. See Create variables for more information. -
-
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".
-
Click
Add.
When you remove a Loop node, the system removes any unused variables within the node.