Looping in streams
With looping you can automate repetitive tasks in streams; examples may include the following:
- Run the stream a given number of times and change the source each time.
- Run the stream a given number of times, changing the value of a variable each time.
- Run the stream a given number of times, entering one extra field on each execution.
- Build a model a given number of times and change a model setting each time.
You set up the conditions to be met on the Looping subtab of the stream Execution tab. To display the subtab, select the Looping/Conditional Execution execution mode.
Any looping requirements that you define will take effect when you run the stream, if the Looping/Conditional Execution execution mode has been set. Optionally, you can generate the script code for your looping requirements and paste it into the script editor by clicking Paste... in the bottom right corner of the Looping subtab; the main Execution tab display changes to show the Default (optional script) execution mode with the script in the top part of the tab. This means that you can define a looping structure using the various looping dialog box options before generating a script that you can customize further in the script editor. Note that when you click Paste... any conditional execution requirements you have defined will also be displayed in the generated script.
To set up a loop
- Create an iteration key to define the main looping structure to be carried out in a stream. See Create an iteration key for more information.
- Where needed, define one or more iteration variables. See Create an iteration variable for more information.
- The iterations and any variables you created are shown in the main body of the subtab. By default, iterations are executed in the order they appear; to move an iteration up or down the list, click on it to select it then use the up or down arrow in the right hand column of the subtab to change the order.