Using loops in Automation 360 allows for developers to control how many times, and under what conditions, actions are run in a repetitive basis. Mastering loops means having full control over your bot’s actions, and making sure that the bot can dynamically handle a single operation or multiple operations in a single bot run. Loops are one of the most powerful constructs in bot building. Loops are instructions that repeat-containing actions for a specific number of times or until it satisfies a specified condition. In a loop, the loop checks for the completed number of specified iterations or the satisfaction of a condition. If it doesn’t satisfy that condition or the number of iterations, then it will execute the operations within the loop. The same conditions are checked for again and again until the condition(s) has been satisfied, at which point the logic inside the loop is no longer executed. Each time it checks the condition for satisfaction is called an iteration of the loop.
Watch a short video on using loops within an Automation Anywhere bot
Take a look at the documentation on the Loop package.
Technically, there are only 3 actions: Loop, Continue, and Break.
Loop is the action developers will most commonly used to customize the repetitions of their bots. There are 2 subtypes of this action. While loops and Iterator loops - each with several customizations options.
Continue enables the loop to move immediately on to the next iteration of the loop - typically used in conjunction with a conditional statement that identified no further action is required for this iteration.
Break terminates the loop immediately. No further iterations would execute. Developers typically opt to use this when iterating through a list to find the first match - after which no further matches need to be fetched.
Complete the following Step-by-step guide to building a Shopping List bot which uses the Loop command to iterate through a csv.
Loops can be very powerful when used correctly in bot builds especially when actions need to be taken a variable number of times. If you automate a process that “sometimes needs to run once, but sometimes needs to run multiple times”, you’ll know that it’s going to be an excellent opportunity to build the bot dynamically in order to handle variability using loops.