Loop

Iterate a defined number of times for a repetitive operation. Equivalent to a for loop in code. The primary purpose of this node is to repeat a section of a Workflow.

Revision History

1.2.1.0 The Group property is now scoped to the Workflow instance.

Properties

Group

Type: String Input
A user-defined value that is used to link a Loop Node to a Loop Exit Node. This property is required only when using a Loop Exit Node.

Start

Type: Int32 Input
The initial value for the loop counter. The first time the loop runs, the Current property will be set to this value.

Stop

Type: Int32 Input
The final value for the loop counter. The loop will continue to run as long as the Current value has not exceeded this value.

Increment

Type: Int32 Input
The value to add to the counter in each iteration of the loop.

Current

Type: Int32 Output
The value of the counter on the current iteration of the loop.

Using the Node

To use this node, you need to define the iteration sequence:

  1. Set Start to the number your loop should begin at.
  2. Set Stop to he number your looop should end at.
  3. Set Increment to the amount the counter should change by in each step.

For example, to create a loop that counts from 1 to 10, you would set:

  • Start = 1
  • Stop = 10
  • Increment = 1

The Node has two outputs: Loop and Finished. The Loop branch is followed for every iteration, while the Finished branch is followed only after the loop has completed all iterations. When the loop complets, the Finished output will fire.

Remarks

To prevent unintended behavior, the Node will throw an "Indefinite loop detected!" error if the configuration would never allow the Stop value to be reached.

Note that this Node will exit prior to completion of all iterations if a request is made to stop the Workflow.

You can stop a loop prematurely by using a Loop Exit. To do this, provide a matching name in the Group Property of both the Loop and Loop Exit Nodes and make note of the following:

Parallel Sub-Workflows: As of Loop v1.2.1.0 and Loop Exit v1.2.1.0, the Group property only applies within the single workflow instance that is currently running, including any sub‑workflows you call one after the other (serially). Each branch of a parallel sub‑workflow runs in its own isolated instance, so a Loop Exit in one branch cannot appropriately communicate with its outer Loop simultaneously that other branches may. In other words, you cannot pair a Loop with a Loop Exit that lives in a parallel sub‑workflow.

Aligned/Matching Versions: Prior to Loop v1.2.1.0 and Loop Exit v1.2.1.0, the Group property automatically applied to all workflows on the same Site, which could lead to unintended cross‑workflow exits. To avoid confusion and unexpected behaviour, always align Loop and Loop Exit versions - and use identical Group names.

See Also

Loop Exit