Information for: DEVELOPERS   PARTNERS

Loop node

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

To use a loop node you will need a schema location that typically contains a JavaScript array and a graph to process each element in the array.

The loop node will call the graph once for each entry in the array sequentially. If the data provided to the loop node is not a JavaScript array it will be converted into an array of length one. Arrays can often be returned by web services or database end points.

Creating a loop node

Unlike other node types, loop nodes can only be added directly from an existing graph, and not through the New menu option. To add a loop node to a graph:

  1. Sign in to your Acquia Journey interface.
  2. On the Home Screen, identify the project you want to customize.
  3. In the project’s tile, click the Project Editor icon.
  4. Double-click the graph you want to edit.
  5. In the white background of the Graph, right-click and choose Add Node to Graph.
  6. Scroll down to the Basic Nodes section, and click Loop.
  7. Click Add Loop.
  8. In the right-hand sidebar, scroll to the Edit Loop Node panel and click the Expand icon.
  9. In the fields provided, define your sources.
  10. Click Replace Node.

Note

  • 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 changes to the schema or a public variable in one sub-graph will be available to the next sub-graph.