# Repeat

### Description

The `Repeat` action repeats the pipeline or workflow of your choice until a certain condition is met. The condition is either:

* A variable in the workflow is set or set to a certain value
* The End Repeat action is executed in the specified repeating workflow

In addition to the workflow and pipeline executor transforms, the Repeat and [End Repeat](/data-shaper-1.21/knowing-the-data-shaper-designer/workflows/actions/repeat-end.md) actions let you build loops from a workflow. It requires a workflow or pipeline and a run configuration to use. The action will continue to execute the specified workflow or pipeline until a condition is met: either a variable is set or a variable set to an specific optional value, or an End repeat action is triggered in a child workflow.

{% hint style="info" %}
Tip: If you use a variable name for the file to repeat, ensure a default parameter is set with a file extension so Hop knows if it is a pipeline or a workflow file.
{% endhint %}

{% hint style="info" %}
Tip: A variable set with a scope of 'valid in the JVM' in a pipeline will not be accessible upstream of a repeating pipeline.
{% endhint %}

### Example

The samples project example: `/loops/repeat-action.hwf` and `child-check-set-counter-value.hpl` runs a pipeline that increments a `${COUNTER}` variable with each run. If the variable values exceeds 10, a variable `${END_LOOP}` is set. This variable is detected by the Repeat action, and the loop stops. Because the Variable scope of `COUNTER` in the workflow is set to “Valid in the current workflow”, when you set `COUNTER` in the child the new value goes upstream.

### Options

| Option                                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Workflow action name                     | The name of the workflow action.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| File to repeat                           | The filename of the pipeline or workflow to execute repeatedly.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Run configuration                        | <p>The pipeline or workflow run configuration to use.<br>Note: if you set a variable on a remote server the value is currently not reported back so only local workflow engines are currently supported.</p>                                                                                                                                                                                                                                                                                                                                                    |
| Stop repeating when this variable is set | Specify the variable you want to be checked before stopping the repeat loop                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Optional variable value                  | Only stop repeating when the above variable is set and contains this exact value. If you stop the Repeat downstream with a variable value that was set via scope: valid in the Java Virtual Machine, you will have to reset the variable manually in the same way because resetting the stop variable in the Repeat’s Parameters/Variables tab will not work.                                                                                                                                                                                                   |
| Delay in seconds                         | Add a delay of x seconds between repeated executions of the selected workflow or pipeline.                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| Keep variable values after execution     | This option keeps the variable values after a (repeating) pipeline or workflow execution to inject into the next iteration.                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Logging file                             |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Log the execution to a file?             | Check if you want to log the repeated executions of the selected workflow or pipeline to a log file                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| Base log file name                       | The base log filename to use to which the options below can optionally be appended.                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| Log file extension                       | The extension to use for the log file                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Add date to filename?                    | Add the current date to the log filename                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Add time to filename?                    | Add the current time to the log filename                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Add repetition number to filename        | Add the repetition number to the log file name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Append to any existing log file          | Append instead of creating a new file when the current log file already exist.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Log file update interval?                | The update interval (in milliseconds) to update the log file                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Parameters/Variables to set              | <p>You can specify the values of any parameters or variables in this dialog. The values can contain variables themselves which will be resolved before every iteration. If the option <code>Keep variable values after execution</code> is set we evaluate the expression only once before the first execution of the file.</p><p>To send Parameters to a Repeat Action, set the parameters/variables name and Value columns. Value can be hard-coded or reference a parameter/variable name. Parameters do not automatically flow through a Repeat Action.</p> |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.primeur.com/data-shaper-1.21/knowing-the-data-shaper-designer/workflows/actions/repeat.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
