Try OpenEdge Now
skip to main content
Developing BPM Applications with Developer Studio
Setting workstep properties : Defining properties of Activity worksteps : Specifying general properties of Activity workstep : Defining a Loop condition
 
Defining a Loop condition
A Loop occurs when the workflow is repeated through the current workstep until a specified loop condition is met. To track the number of times the workstep is executed, you can define a counter that increments every time the loop is executed.
To define a Loop condition:
1. From the General tab of an Activity workstep’s Properties view, select the Loop checkbox, beside the adjacent field and ellipsis button.
2. Click the ellipsis button to open the Loop dialog box, in which you can define the Loop condition.
3. Enter a variable (note that the variable must be a INTEGER dataslot type) by clicking the ellipsis button beside the Variables box. From the Select Dataslots dialog box, select a INTEGER dataslot type from those listed. Each time the workstep executes the loop, this variable is incremented by one.
4. From the Condition section, build a condition by selecting a dataslot from the drop-down list on the left and an operator from the middle drop-down list, and then selecting or entering a value in the drop-down list on the right. To enter a value, do the following:
a. Open the drop-down list on the right and select Enter Value option, to open the Enter Value dialog box.
b. Enter the value and click OK.
5. Click OK after defining the loop condition for this workstep.
As long as the defined condition is “true”, the workstep will execute a loop. When the condition reads “false”, the workflow passes to the next workstep.
Consider an example of a counter-controlled loop, where the first condition sets the workstep to iterate five times. To do this, set the count dataslot to “is less than or equal to”. On the sixth iteration, the workflow will go out of the loop and continue to the next workstep. This type of loop is useful if, for example, you wanted a user to enter data five times before proceeding to the next workstep.
The second condition indicates that the Assignee dataslot must equal “Jones”: if the assignee is not Jones, the condition is false and the workflow proceeds to the next workstep.
When a workstep is defined as a Looping workstep, the Loop icon ( ) appears within the workstep shape, indicating to other users that a loop occurs in this workstep.
Note: If a workstep has both a Skip condition and a Loop condition, the Skip condition is evaluated first. If it evaluates to true, the workstep is skipped; if false, the workstep is executed and the Loop condition is evaluated. If the Loop condition is evaluated as true, the Skip condition is evaluated again.
Note: You can enter a description (optional) for the Activity workstep in the Description tab. A description can be up to 4095 characters.