<< Click to Display Table of Contents >> Compound conditions in actions and validations |
In many situations it is desirable to establish more complex conditions to perform an action or throw a validation. In the previous examples we learned how to define simple conditions. We will continue to define multiple conditions connected by the logical AND and OR operators and to establish groups of conditions.
Using the logical operators AND and OR in nested conditions
And and Or operators are used to link conditions and define them as being inclusive or exclusive. These operators become available in Actions & Validations when more than one condition is defined.
Example
Suppose in the Credit Request process, it has defined a policy for credit approval to reduce approval waiting times and offer a superior customer service.
This policy will apply to applicants age 25 and younger. If the requested amount is less than 3000 USD, the credit will be approved; otherwise, further analysis will be required.
•The applicant's age is stored in the Applicant Age attribute.
•The approval decision is stored in the Boolean attribute called Credit Approved.
We will value the Credit Approved attribute (true or false) in an action according to the condition:
1. Go to the activity form, add the necessary controls and click the Actions & Validations icon located in the ribbon.
Add a new action by clicking the Add button.
2. Click Add a condition and define the first condition in respect to the applicant's age:
3. Add the second condition that evaluates the requested amount. Note the logical operator is now enabled.
4. Change the operator to and to define the inclusion of the component conditions i.e. to specify that both of these conditions must be met.
5. In the Then section define the action to perform when the condition is met. That is, assign Yes to the Credit Approved control.
6. Add an Else section by selecting the + Else button.
7. As a default, assign No to the Credit Approved control.
8. Click Apply to save the changes and then, save the form.
Using groups of conditions
You may need to define groups of conditions to built more complex evaluations. Each group of conditions has one or more single conditions linked by AND and OR operators. Likewise, groups are interconnected by AND/OR operators in order to define their inclusion or exclusion.
Groups of conditions are defined by clicking the Add a group button.
Once clicked, a new condition block will be inserted within the conditions section.
Example
We will build on the example in the previous section. Suppose that a concession has been added to the credit approval policy for the more mature client .The new policy will be as follows:
•If the applicant is 25 years of age or younger, and the requested amount is less than 3000 USD then the credit will be outright approved .
•If the applicant is 60 years of age or older, and the requested amount is less than 6000 USD then the credit will be outright approved.
Recall that the approval decision is stored in the Boolean attribute Credit Approved. We need to define an action to set the value of this attribute (to true or false) based on the conditions defined:
1. Go to the activity form, add the necessary controls and click the Actions & Validations icon located in the ribbon.
Add a new action by clicking the Add button.
2. Click the Add group:
3. Within the condition group block, define the two conditions for young applicants.
4. Click the Add group button to add another group.
5. Within the second block, define the two conditions for elder applicants. First add the condition to evaluate the applicant's age.
6. Then add another condition to evaluate the requested amount.
7. Select the or operator to perform a logical exclusion on the two groups.
8. In the Then section, define an action to assign Yes to Credit Approved control.
9. Add an Else section by selecting the + Else button.
10. The default action will be to assign No to the Credit Approved control.
11. Click Apply to save your changes and then, save the form.
Last Updated 9/27/2022 7:11:49 PM