Defining a loop condition
You specify that the Transformer stage loops when processing each input row by defining a loop condition. The loop continues to iterate while the condition is true.
- If required, open the Loop Condition grid by clicking the arrow on the title bar.
- Double-click the Loop While condition, or type CTRL-D, to open the expression editor.
- In the expression editor, specify the expression that controls your loop. The expression must return a result of true or false.
It is possible to define a faulty loop condition that results in infinite looping, and yet still compiles successfully. To catch such events, you can specify a loop iteration warning threshold in the Loop Variable tab of the Stage Properties window. A warning is written to the job log when a loop has repeated the specified number of times, and the warning is repeated every time a multiple of that value is reached.
So, for example, if you specify a threshold of 100, warnings are written to the job log when the loop iterates 100 times, 200 times, 300 times, and so on. Setting the threshold to 0 specifies that no warnings are issued. The default threshold is 10000, which is a good starting value. You can set a limit for all jobs in your project by setting the environment variable APT_TRANSFORM_LOOP_WARNING_THRESHOLD to a threshold value.
The threshold applies to both loop iteration, and to the number of records held in the input row cache (the input row cache is used when aggregating values in input columns).