Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Loop Node allows a sub-graph to be executed many times from the same position in a graph.

...

The graph shows one transaction executing but the testing console will show the iterations of the loop node and the Display JSON button will show the state of the data store at the end of that iteration. The output of the subgraph can be seen in each transaction as the loop node iterates over the array. Image Removed

Notes

  • A loop node graph can not call itself and the graph will not appear on the Using Graph dropdown
  • The loop node processes the array sequentially and the graph state is global so that changes to the schema or a public variable in one sub-graph will be available to the next sub-graph 
  • To use the Loop Node as a way to insert multiple records into a database within the loop use a DB node to insert where the singular record of data exists 

...

This is the array of words:
["The","quick","brown","fox","jumps","over","the","lazy","dog."]

The set node below sets a schema location with this array of words which is then used in the loop node. 

These are the two graphs. The upper picture is the main graph and the bottom picture is the graph the loop runs with. The JavaScript node's output is stored in a separate schema location compared to where the words are stored, the code is shown below along with the testing console output.

The following screenshot shows the final result of the graphs.

Image Removed

The array of words is stored in the 'data' portion of the schema while the built sentence is stored in the 'result' part of the schema, both under the 'loopData' section.

...