Creating an iteration key for looping in streams
You use an iteration key to define the main looping structure to be carried out in a stream. For example, if you are analyzing car sales, you could create a stream parameter Country of manufacture and use this as the iteration key; when the stream is run this key is set to each different country value in your data during each iteration. Use the Define Iteration Key dialog box to set up the key.
To open the dialog box, either select the Iteration Key... button in the bottom left corner of the Looping subtab, or right click on any node in the stream and select either or . If you open the dialog box from the stream, some of the fields may be completed automatically for you, such as the name of the node.
To set up an iteration key, complete the following fields:
Iterate on. You can select from one of the following options:
- Stream Parameter - Fields. Use this option to create a loop that sets the value of an existing stream parameter to each specified field in turn.
- Stream Parameter - Values. Use this option to create a loop that sets the value of an existing stream parameter to each specified value in turn.
- Node Property - Fields. Use this option to create a loop that sets the value of a node property to each specified field in turn.
- Node Property - Values. Use this option to create a loop that sets the value of a node property to each specified value in turn.
What to Set. Choose the item that will have its value set each time the loop is executed. You can select from one of the following options:
- Parameter. Only available if you select either Stream Parameter - Fields or Stream Parameter - Values. Select the required parameter from the available list.
- Node. Only available if you select either Node Property - Fields or Node Property - Values. Select the node for which you want to set up a loop. Click the browse button to open the Select Node dialog and choose the node you want; if there are too many nodes listed you can filter the display to only show certain types of nodes by selecting one of the following categories: Source, Process, Graph, Modeling, Output, Export, or Apply Model nodes.
- Property. Only available if you select either Node Property - Fields or Node Property - Values. Select the property of the node from the available list.
Fields to Use. Only available if you select either Stream Parameter - Fields or Node Property - Fields. Choose the field, or fields, within a node to use to provide the iteration values. You can select from one of the following options:
- Node. Only available if you select Stream Parameter - Fields. Select the node that contains the details for which you want to set up a loop. Click the browse button to open the Select Node dialog and choose the node you want; if there are too many nodes listed you can filter the display to only show certain types of nodes by selecting one of the following categories: Source, Process, Graph, Modeling, Output, Export, or Apply Model nodes.
- Field List. Click the list button in the right column to display the Select Fields dialog box, within which you select the fields in the node to provide the iteration data. See Selecting fields for iterations for more information.
Values to Use. Only available if you select either Stream Parameter - Values or Node Property - Values. Choose the value, or values, within the selected field to use as iteration values. You can select from one of the following options:
- Node. Only available if you select Stream Parameter - Values. Select the node that contains the details for which you want to set up a loop. Click the browse button to open the Select Node dialog and choose the node you want; if there are too many nodes listed you can filter the display to only show certain types of nodes by selecting one of the following categories: Source, Process, Graph, Modeling, Output, Export, or Apply Model nodes.
- Field List. Select the field in the node to provide the iteration data.
- Value List. Click the list button in the right column to display the Select Values dialog box, within which you select the values in the field to provide the iteration data.