Transformers

While

Repeats the loop body until a payload field says to stop — polling, retrying, paging.

control.while
TRANSFORMWhile

At a glance

Takes
Any payload, which becomes the loop's seed
Emits
The last pass's payload on Done, plus _while_exceeded if it ran out
Good for
Waiting for something to finish, or walking pages until there are none left

Set it up

Wire the orange Loop outlet to the body and the green Done outlet to what follows. The condition is checked before the first pass, so a seed that already satisfies it runs the body zero times. After each pass the last node's output becomes the payload the next check reads.

The inspector for While: a field, a value, until or while, and a ceiling.
The inspector for While: a field, a value, until or while, and a ceiling.

Configure

FieldDefaultWhat it does
Condition FielddoneThe payload key to read each pass. Dot paths work: data.done.
Condition ValuetrueWhat to compare it against. {{variable}} templates are re-resolved every pass.
ModeLoop until field equals valueOr Loop while field equals value, which exits when it stops matching.
Max Iterations20The ceiling that stops a runaway loop.

The comparison is a plain text match between the field's rendered value and the rendered condition value.

Output

KeyOutletValue
_while_exceededDonetrue when the loop stopped because Max Iterations was reached with the condition still unmet. Absent otherwise

Done otherwise carries the payload the last pass produced, so whatever the body built is there to use.

Example: poll until a job reports done

Input seeds the flow. While loops until {{status}} equals finished; each pass runs a Script that checks and sets status. Log prints the result once Done fires.

Four nodes: seed it, loop the check, carry on when it finishes.
Four nodes: seed it, loop the check, carry on when it finishes.

Paste this into the Flow Builder to get the same flow:

Loop a shell check until the payload's status equals finished, at most ten times, then log the final payload.

Good to know

Nothing inside the loop sets the field for you. If the body never writes the Condition Field, the loop runs to Max Iterations and leaves _while_exceeded on the payload. Branch on it with a Condition if a timeout matters.

The condition value is re-read every pass. {{target}} compares against a value the body itself can change, which is how a "until we reach the count we were told" loop is written.

Every pass is its own log block, numbered and streaming as it completes, so a long poll can be watched while it runs. History keeps the newest 500 passes.