Node - Loop
Function Overview
The Loop node allows a portion of the workflow to be executed repeatedly. Looping can be configured either for a specific number of times or based on certain conditions, continuing until an exit condition is met.
-
Loop based on conditions
The workflow will continue to loop through a specific process until the parameters meet the defined exit condition.
-
Loop a specific number of times
Loops are executed strictly in sequence — each iteration is carried out one after the other.
Loops are executed strictly in sequence — each iteration is carried out one after the other.
Each loop iteration increases the workflow execution count by one.
Loop a specific number of times
Example: Randomly select 10 questions from a question bank of 100 questions to generate a test paper.
Implementation: Use the “Get Single Data” node to randomly retrieve one question, duplicate the question and link it to the test paper, and mark the original question as “Retrieved.” Repeat this process 10 times. After the loop ends, remove the retrieval marks from the question bank.
Add a Loop node
In the workflow, add a “Loop” node and select “Loop a specific number of times”.

Configuring the Loop node
Parameter settings
When using the “Loop a specific number of times” mode, there are three system-defined parameters: start, end, and step. Only the start values can be configured—these parameter names cannot be deleted or modified.
-
start: The starting value of the loop.
-
step: The increment value added to start after each loop iteration. For example, if start = 1 and step = 2, after the first iteration, start becomes 3.
-
end: The ending value of the loop. The loop exits when start exceeds end, and no further iterations are executed.
In addition to these fixed parameters, you can also pass in custom parameters. For example, in this case, each loop iteration needs to access the newly created test paper record. Therefore, the test paper record ID (exampaperid) should be passed into the loop. Within the loop, the record can be retrieved using this ID.

Add new parameters
To add new loop parameters, they must be defined in the first node within the loop process.

Loop exit condition
When using the “Loop a specific number of times” mode, the loop can only exit based on a comparison between the start and end values.
Execution count examples:
-
start = 1, step = 1, end = 3 → The loop executes 3 times. After the third iteration, start value becomes 4, which is greater than end, so the loop ends.
-
start = 1, step = 2, end = 3 → The loop executes 2 times. After the second iteration, start value becomes 5, which is greater than end, so the loop ends.
-
start = 1, step = 1, end = 0 → The loop executes 0 times, since the initial start value already exceeds end.
Maximum loop count
Loops cannot run indefinitely—the Loop node supports a maximum of 10,000 iterations. Once this limit is reached, the loop will automatically terminate and proceed to execute the subsequent nodes.
Even if the start value is less than the end value, the loop will exit if the maximum number of iterations is reached.