Loop Operator

The Loop operator loops an enclosed sequence of operators in a process either a specified number of times or indefinitely. You can place it in a process and can resize the box to accommodate any number of operators in the sequence.
catpa04303
HID_Loop_Operator
The Loop operator loops an enclosed sequence of operators in a process either a specified number of times or indefinitely. You can place it in a process and can resize the box to accommodate any number of operators in the sequence.
LoopOperator.png
The Loop operator can enclose a sequence of operators in a process on the Main Editor pane, the Exception Handler pane, or the Lane Change Handler pane of the Designer tab.
Follow these steps:
  1. Drag the Loop operator from the Standard folder to an editor.
  2. Drag one or more input links to the input portal, and one or more output links from its output portal.
  3. Add looped operators inside the Loop box.
  4. Link the input portal to the first operator in the looped sequence.
  5. Link the last operator in the sequence to the output portal.
Input Parameters
Repeat Count
Specifies the number of times that an operator repeats. The following two options are available:
    • This value can be specified with an integer or a 
      CA Process Automation
       expression that returns an integer at run time. The default value of 1 executes a loop on an operator a single time in a workflow. To execute an infinite loop, click the Infinite Loop check box.
    • A Boolean expression can also be used. As long as the expression evaluates to true, an operator in a workflow executes a continual loop. If the expression is false, the operator exits.
This value can also be specified using the loop variables in the dataset of the Loop operator:
    • CurrentLoopIteration: A loop counter that starts at 0 during the first iteration of the loop and increments by 1 for each additional iteration. This variable is updated at the beginning and end of every iteration.
      If the operator is configured to loop three times, at the end of execution of all iterations, CurrentLoopIteration is equal to: 
      • 0 in iteration 1 
      • 1 in iteration 2 
      • 2 in iteration 3 
      • 3 in the last iteration, which is not executed as it violates the loop condition.
    • OverallLoopDuration: A loop counter that specifies the amount of time (in seconds) that has passed since the start of the first iteration of the loop. This variable is updated at the beginning and end of every iteration and includes any delay that is set between iterations of the loop.
Set the Repeat Count to:
Process[OpName].CurrentLoopIteration < 
x
where
x
 
is the number of times to run the operator.
Or, set Repeat Count to:
Process[OpName].OverallLoopDuration < 
x
where
x
 is the number of seconds to loop the operator. The operator does not stop at the number of seconds specified when it is in the middle of an iteration. Instead, if OverallLoopDuration is greater than the number of seconds specified, the operator does not execute the next iteration.
CA Process Automation
 checks the loop condition between iterations.
Infinite Loop
When selected, Repeat Count is ignored and an infinite loop is created. The operator keeps repeating until either: 
  • The process is interrupted. 
  • The loop is stopped from a different branch of the process (by processing a stop loop command link to the Loop Operator).
Delay between iterations
Specifies the delay in seconds between each loop iteration.
While loop 
When selected, the Loop operator behaves as a
 while 
loop. If unselected, the Loop operator behaves as a 
do while
 loop.
While loop
The Loop operator checks the loop condition specified in the Repeat Count field before it executes any iteration, including the first iteration.
Do while loop
The Loop operator checks the loop condition specified in the Repeat Count field at the end of every iteration, so it is guaranteed to execute at least the first iteration of the loop.
All existing loop operators that are imported from CA Process Automation before v4 have the While Loop field unchecked. These existing operators continue to work as Do while loops, as they did in previous versions.
Pre- and Post execution Code 
Use these fields to execute JavaScript code to execute with each iteration of the loop. 
The processing sequence of any Pre and Post condition depends on the type of loop. See the 
Content Designer Guide
 to learn more about the logical sequence of a loop.
Output Parameters
CurrentLoopIteration
A loop counter that starts at 0 during the first iteration of the loop and increments by 1 for each additional iteration. This variable is updated at the beginning and end of every iteration. If the Loop operator is configured to loop three times, at the end of execution of all iterations, CurrentLoopIteration is equal to:
  • 0 in iteration 1
  • 1 in iteration 2
  • 2 in iteration 3
  • 3 in the last iteration, which is not executed as it violates the condition of the Loop operator.
OverallLoopDuration
A loop counter that specifies the amount of time (in seconds) that has passed since the start of the first iteration of the loop. This variable is updated at the beginning and end of every iteration and includes any delay that is set between iterations of the loop.