Loop package - 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.

Automation 360

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.

When you run a sequence of actions repeatedly for a specific number of times, the end condition is evaluated in every iteration. For example, consider looping through a Data Table with 10 columns:
  • Enter the dynamic values of the column count as the end condition.
  • Inside the loop body, use the Data Table > Delete column action to delete the column at index 0.
  • When you run the bot, it deletes a column in each iteration.
As a result, the iteration count decreases because the end condition is evaluated during every iteration.
Note: You can run the bots with a maximum of 97 nested loops.

Labeling loops for automation control

Loop labels identify and manage different loops within a bot. They help distinguish between multiple loops, especially in nested scenarios. Loop labels let you specify which loop to continue, break, or exit — beneficial in complex automation with multiple nested loops.
Note: To add loop labels, ensure that you build your bots using Loop package version 3.7.4. This feature is not backward compatible.
To add labels to the Loop, Continue, or Break actions, in the Label field, specify a label to identify your loop.
Note:
  • Ensure that each loop label in a specific bot is unique.
  • The Label field supports only alphanumeric characters.
The following example describes how to use the Label field to break or continue a loop in a bot:
  • In the Label field of the first Loop action, specify outerloop.
  • In the Label field of the second Loop action, specify innerloop.
  • In the Loop > Continue action, in the Label field, select the label of the loop from which you want to continue.
  • In the Loop > Break 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.

How labeling works in loop

In a bot with multiple nested loops that include Loop > Continue and Break actions, if you have not labeled the loops, the bot breaks or continues the nearest loop by default.

For example:
  • An outer loop and an inner loop nested within it.
  • A Loop > Continue and Break action inside the inner loop.
If none of the loops are labeled, when you run the bot, it breaks or continues the nearest loop (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.