## Repeat For

This function allows you to call an action a specific number of times. This function is analogous to a typical for statement in a traditional programming language.

A variable or named variable is specified to contain the current value.

You specify start, stop and adjustment values. The three value fields may contain any of the escape sequences described in Escape Sequences. At run time each of the fields is read as a signed integer value. The current value is initialized to the start value. The adjustment value is effectively added to the current value at the end of each full iteration.

You also specify a test condition used to compare the current value with the stop value. The repeat process terminates when the comparison is false. The comparison test is performed at the start of each iteration. Note that if the adjustment value evaluates to 0, no repeating will occur.

The execution profile is as follows:

> Initial mode stepwise, designated action does not specify Run grouped
>   The designated action will be run once for each valid value in the specified range.
> Initial mode stepwise, designated action specifies Run grouped
>   The designated action will be run with the first value for each selected file. It will then be run with the second value for each selected file. etc. For three generated values and ten selected files, the action will be run thirty times.
> Initial mode grouped
>   The designated action will be run once for each value.

When Run Grouped is selected, you can choose to run the action only once. The effect is that only a single file is processed. This is useful when the repeated action is processing data which is independent of the metadata in the tracks. For example you might be enumerating the ros in a query database. This combination of options is similar to the Constrain Execution to a Single File statement.

Note that if the designated action contains a Force Grouped function, it is equivalent to specifying the Run grouped option.

Note also, that regardless of the execution mode, an Exit Repeat statement will terminate all repeating.

The Repeat For statement can specify that the named action is inline. When Inline is specified there must be a Start function inside the current action with the specified name.

The Indirect option enables the use of Escape Sequences in the text field where you specify the name of the action to be run. This enables you to choose the action to be run based on the contents of Variable fields or any other constructed pattern. The action name is only validated at run time. If the evaluated name is empty, the Repeat For statement is ignored. You can setup lists using the various list functions to contain the names of actions; inline or not. By using the List Item At Index function, you can pull an action name and place it in a variable which can then be specified in the Repeat For statement.

Note that all values are evaluated once. Changing the value of the current variable or named variable's contents will have no effect on subsequent iterations.

Example: Repeat For named variable 'index' = '0' while < '\<Query Database-Row Count>' by '1' Run inline action 'Process Database Row' grouped (once)

> The inline Process Database Row action will be successively called with named variable index for every row in Query Database.