Repeat — Reference
Execute nested server steps once for each record and collect per-iteration outputs.
Execute nested server steps once for each record and collect per-iteration outputs.
Before you begin
Section titled “Before you begin”- An open Server Connect action. Runtime differences below refer to the installed Node.js and PHP implementations.
Repeat
Section titled “Repeat”Execute nested server steps once for each record and collect per-iteration outputs.
Settings and execution
Section titled “Settings and execution”| Setting | Meaning |
|---|---|
| Name | Names the array of results from the repeat. For example, processed is available to later server steps. |
| Expression | The collection to iterate. Prefer an array of records for portable behavior. This is a server-side loop, separate from a page-side repeat that renders HTML. |
| Output | Includes the repeat’s result array in the action response. Inner steps control which calculated values appear within each item. |
| Output Filter | Controls copying original record fields to each output item: Include copies only the selected fields; Exclude copies fields except the selected ones. |
| Output Fields | The original record fields to include or exclude. With Include and no fields selected, no original record fields are copied automatically; nested output steps can still add values. |
| Exec | The steps to run for each item. The current record’s fields are in scope, along with $value, $key, $index (zero-based), $number (one-based) and $oddeven. |
Worked example
Section titled “Worked example”Repeat a products array containing {id:1,name:“Notebook”} and {id:2,name:“Pencil”}. Select Include and the name output field. Name the repeat processed and enable Output. With no extra calculated outputs, the result should contain processed = [{“name”:“Notebook”},{“name”:“Pencil”}].
Check the behavior and limits
Section titled “Check the behavior and limits”Do not pass a comma-separated string as a portable substitute for an array: Node.js splits strings on commas, while PHP splits them into characters. Use an explicit array. Break exits the current loop; the iteration already started may contribute its output.
Continue with a task
Section titled “Continue with a task”Use the Server Connect guides when you need the surrounding project, data-loading or form procedure.
Check your result
Section titled “Check your result”You can configure Repeat deliberately and verify the result and failure behavior described in this reference.