Loops
What are loops?
Loops are closely tied to Variables because they offer the possibility to use different variable values for each task run. For example, suppose you want to process the contents of ten separate web pages. In that case, you have Yarado visit those ten webpages by including those steps into a loop and use a different value for the variable with the web page URL each run. By doing so, you only have to record a single iteration of your process and infinitely scale it afterwards.
There are two steps required when adding a loop:
- Indicate which parts of the task need to be included in the loop.
- Provide the different variable values for each loop in the form of a loop file.
Adding a loop to a task
Loops are very flexible and can consist of entire tasks or just a few steps. To add a loop to a task, right-click on the step where you would like to loop to start and select Steploop → Setloop Start.
Add a loop.
To define the end of a loop, go to the step where you would like the loop to end, right-click on the step and select Steploop → Setloop End.
Note
A loop must always contain at least two steps, and the end of a loop must always be in the first column of steps.
In case the task section you wish to loop over ends with an IF or and Advanced IF, you will need to add an extra step like a Mouse Action to bring the task back to the first column and end the loop there.
Adding a loop file or data
To add data, select the Loop tab of the process visualiser. This will bring up the loop datasheet at the bottom of the screen.
Loop datasheet.
The loop datasheet loops and works much like an Excel spreadsheet. When empty, you see placeholder column names like Col 1, Col 2, etc.
The rows of the loop datasheet determine the number of loops in a task, while the columns can be linked to variables, meaning each row can contain different variable values.
Example of loop datasheet.
Manually adding data
It is possible to add data to the loop datasheet manually, just type the data you want to process into the rows of the datasheet and right-click on the column name to link it to a variable manually.
Manually link variables.
Importing a loop file
Note
In the Yarado settings, you can indicate the CSV file separator key. This can either be a comma, semicolon or tab.
A more efficient way to add data to the loop datasheet is by importing a loop file. A loop file is a .csv file that contains the variable values for the loop datasheet.
Load a CSV loop file.
In case the CSV file contains headers that have the corresponding names of the variables you would like to link them too, Yarado can automatically link those for you.
Dynamically loading loop file
Often, the first part of a task extracts or processes data, while the second part loops over that data to perform specific actions. In Yarado, it is possible to load a loop file dynamically, based on particular conditions using the Case CSV function.