Loop Until
Loop Node
In Presence Tasks, as with While Nodes it is impossible to link a Node into an earlier Node in the Execution Path as this leads to infinite recursion.
However looping functionality is often desirable, and the Loop and While Node serves this purpose - it will continue to repeat execution of subsequent Nodes until the number of iterations has been performed. This Node differs from the While Node in that is will only repeat a process n times. It also makes doing iterative loops easier as you don't have to keep your own counter as you would have to with the While Node.
Here is an example of a Task that uses a Loop Node: Example Task
This example performs the following:
1 Start of Task
2 Set Task Variable ${sine_iteration_array} to " " (empty)
3 Set Task Variable ${sine_array} to " " (empty)
4 Set Local Visibility variable ${iterations} to 360
5 Passive Node is to control the Execution Paths so that our loops are done first and the values of the calculation and iteration number is stored in Task Variable.
6 Start the Loop and continue until the internal ${loop.count} variable has reached the ${iterations} (360) value passed in.
- Calculates a Sine plot in the local variable ${sine_plot} using the internal counter ${loop.count}
- Appends the value of the local variable ${sine_plot} to the Task Variable ${sine_array}
- Appends the value of the local internal variable ${loop.count} to the Task Variable ${sine_iteration_array}
7 Uses the function Multi-Column Split to create a Data Table (for the Graph Node) from the ${sine_array} and the ${sine_iteration_array}
8 Drops any empty rows (first row is always empty in this example) using the Drop Row(s) node.
9 Creates the Sine graph from the Data Table.
10 Ends the Task
This is the product of the task
Loop Node Iteration is faster than the While Node due to no other rules are being evaluated at every iteration.
Using the Loop Node
Drag the "Loop" Task Element from the toolbox onto your Task Edit View. You will then be presented with the following Dialog Box:
You can enter a static value, a Data Table Column (:var{COLUMN_NAME}) or a variable (${variable_name}), if you use a Column Name then the loop will iterate over the data table for each unique value in the Column, see Implicit Iteration for more information.
The Checkbox "Iterate on duplicate data table values" will process all result sets using Implicit Iteration
See Also
While Node Task Elements > Flow Control Task Elements > Loop Until