The Loop package in Automation 360 repeats a set of bot actions based on specified conditions, such as, iterating over lists, number ranges, or until a condition is met. RPA developers use loops with labels, break, and continue actions to control complex nested automation flows.
For instance, repeat the set of actions that read data from each row of a Microsoft Excel file, rename all files in a folder, and save each email in a mailbox. You can also use the If action within the Loop action to validate a condition, and based on the outcome of it, skip the current iteration in the loop or even break the loop. For more information on using the If action, refer to the If package documentation.
For conditional loops, different actions are taken depending on whether the conditional parameters are met. For loops with a specified number of iterations, the loop exits on the last iteration and continues to the next step in the bot.
- Enter the dynamic values of the column count as the end condition.
- Inside the loop body, use the action to delete the column at index 0.
- When you run the bot, it deletes a column in each iteration.
Labeling loops for automation control
- Ensure that each loop label in a specific bot is unique.
- The Label field supports only alphanumeric characters.
- In the Label field of the first Loop action, specify
outerloop. - In the Label field of the second Loop action, specify
innerloop. - In the action, in the Label field, select the label of the loop from which you want to continue.
- In the action, in the Label field, select the label of the loop from which you want to break.
Watch the following video to see how loops labeling works.
In a bot with multiple nested loops that include and Break actions, if you have not labeled the loops, the bot breaks or continues the nearest loop by default.
- An outer loop and an inner loop nested within it.
- A and Break action inside the inner loop.
Actions in the Loop package
The following Loop actions are available:
| Action | Description |
|---|---|
| Loop | See Loop action for data iteration. |
| Continue |
See Continue action. |
| Break |
See Break action. |