Frequently, your business logic requires that you create looping logic in your business processes. That is, you need to design logic in your business process in which the activities enclosed in a loop are performed repeatedly while a specific condition is true.
While Do, Do While, and For Each node groups represent such points in your business processes. This section describes how to design looping logic in your business processes. It includes the following topics:
Both While Do and Do While node groups support looping logic. Both types of groups represent a point in a business process at which the activities enclosed by the group are performed repeatedly while a specific condition is true. However, While Do and Do While groups represent different execution logic, as described in the following sections:
At run time, the condition on a While Do group is evaluated before the activities in the loop are performed. Therefore, the activities inside While Do groups are performed zero or many times, depending on the results of the evaluation of the condition.
In the case of Do While groups, business process activities are added before the condition in the loop. At run time, the activities defined in a Do While loop are performed; then the condition is evaluated. Therefore, the activities inside a Do While group are performed one or many times, depending on the results of the evaluation of the condition.
Creating While Node Groups in Your Business Process
The Design view is updated to contain a representation of the group you selected as shown in Figure 11-1.
Note the following characteristics of the While groups:
To create logic for your While group, you must complete the following steps:
Double-click in the While group you want to design the condition logic for.
The node builder is displayed. It allows you to create the condition or conditions that are evaluated at run time by the business process.
Note: | The node builder in which you create the conditions for looping is the same as that in which you create conditions on Decision groups. To learn how to design the condition logic for the While group, see To Design the Condition Logic in Defining Conditions For Branching. |
After you define the condition that is evaluated in your While loop at run time, you are ready to define the actions on the loop. To do so, add a node (or nodes) to the path in the While loop. You can add any nodes that perform the activities appropriate for the business logic that you require at this point in your business process.
When you complete the addition of activities on the group, your looping logic is represented by a condition or conditions and a series of business process nodes in the While loop.
You can view and edit the properties of your While group by clicking the outline of the group to select it, then viewing the group properties in the JPD Configuration pane.
For any group of nodes in your business process, including While groups, you can collapse the group to save space on the Design view canvas. Collapsed groups appear in the Design view as shown in the following Figure 11-2.
Defining Conditions For Branching
Looping Through Items in a List
Grouping Nodes in Your Business Process