Loop Begin
This handler collects the information on how many times the loop should process, and any variable provided in the loop that can be used by other handlers.
See screenshots below.
Parameters from the Loop Begin handler:
Data Source: This parameter holds an xml string that defines how many times the loop processes. Here is an example string:
<userID>
<myID>Han Solo</myID>
<myID>Demo</myID>
</userID>
The outer node (userID) is required to encapsulate the inner node (myID) that defines how many times the loop processes. In this case, it will process two times.
Most real world implementations do not use hard coded values like above. In those cases you will have the result goto another node to use in the Data Source field. Task Handlers that can turn either csv or json strings into xml are valuable when using loops. You can find a few in the
Utility category of Kinetic Task.
Loop Path: Used to define the path in the xml document to the data. Example path for the above xml:
//userID/myID
Unlike Data Source this is often a hard coded value. Once the format of the XML is set (normally an output of a previous handler), the path will not change.
Variable Name: a name that is used by nodes within the loop to reference the data from the xml. The most common use is for the data represented by the variable to be used in a lookup of some kind. The only restriction on the variable name is that it cannot be the same as either of the node names from the xml string. In the above example we are using myUserID. userID or myID are invalid variable names. To reference this variable in the other nodes in the loop you add an @ sign, and wrap it in the wrap it "<%" tags, so myUserID would be referenced as <%= @myUserID %>.
Another option that is becoming more popular is to use the output of the Loop Begin node, it has the same value as the Variable Name, but fits in the format used by results and other nodes in the builder. The format is <%=@results['Loop Begin']['Value']%> and is available along with the other Task Results from the Parameter menu in the nodes.