Looping allows you to perform repeated actions a specified number of times
- How to construct a Loop in the Tree Builder
- Learn about the parameters used by a Loop Head and Loop Tail
- How to read a Run of a Loop
Looping in workflow lets you process a set of nodes a specific number of times. However, don't think of looping the like loop structure in a programming language. Looping depends on the Data Source and the Loop Path to determine the number of times the Loop is processed and what is processed. These elements don't change once the loop starts processing.
A Loop consists of three parts, Loop Head, Loop Tail, and any tasks processed during the loop.
The Loop Head is the first node in a loop and holds the Data Source, Loop Path, and Variable Name.
Data Source is either an XML or JSON string. It is normally the result of another node that is passed to the Loop Head.
Loop Path is normally static text that is used to parse either the XML or JSON.
Result: Three loop interations using the values han, luke, rey
JsonPath documentation here
Result: Four loop iterations using the values pilot, CRV, Explorer, Edge
Variable Name was used to indicate the output for each loop iteration, but is not commonly used anymore.
Here's a screenshot of the JSON Loop Head:
The Loop Tail decides when processing exits the loop and continues the tree. A Loop Tail is nearly identical to a Join Node. Instead of using individual branches to compare to its parameter choices (All, Any, Some), it uses loop iterations.
Loop Tails should be connected directly to Loop Head nodes. As long as you add the Loop Tail node directly after the Loop Head, the connection should be fine.
Because a Loop processes the same nodes (Loop Heads and the nodes within a loop) a variable number of times, they are notated like an array. In the following screenshot, there is just one node in the Loop called Loop Operation, but you can see it processed multiple times. There is also one Loop Head for each iteration, but only one Loop Tail.
That is it for the 200 level articles and videos. Congratualtions!
If you have any questions, please check our other articles on Community, or contact Support at [email protected].
The Cleaning Request created in the previous classes is OK, but now we need to improve the User Experience and Workflow.
Updated 16 days ago