Boolean expressions
From Business Process Management, BPM and Workflow Automation Wiki | BizAgi BPMS
Contents |
Boolean Expressions
These are all the rules that should return True or False. The rules that belong to this category can be used in:
Rules associated with transitions
Rules used as conditions for attributes (fields in the forms) to be (or not) visible, editable or required.
Rules used to determine the condition to assign an activity.
There are two types of Boolean expressions: Boolean and Scriptig Boolean
Boolean rules have a simple interface in which users drag and drop attributes to be evaluated.
Scripting Booleans are more complex and need scripting in order to evaluate the conditions to return the value.
Boolean Expressions
This expressions use a simple interface to evaluate one or more conditions.
On the left, the data model is displayed. To build the condition, drag and drop the attributes to be evaluated to the box in the right.
When the attributes are inserted, choose the evaluation condition from the drop down list. Then, select the condition.
- The user can add as many conditions as needed clicking over Add condition on the bottom of the window.
- These conditions can be evaluated when they are ALL met, or when ONE of them is met. (Numbers 1 and 2 in the image)
- The Boolean expression can be reusable, if the user thinks it might be needed somewhere else in the process. (Number 3 in the image)
When the Boolean expression needs to evaluate a condition regarding a Collection (a one-to-many relationship) it is necessary to use the Custom XPaths option. This option is found at the bottom of the Data Model box:
Select the collection to be evaluated. There are seven functions that can be used over the collections:
sum, count, max, min, avg, empty, exists.
In order to add, find the maximum or minimum value or an average, it is necessary to select the attribute over which to evaluate, at the end of the XPath.
In the next image, the Custom XPath will return the sum of all the ValueRequested, of the Products of a Credit Request process.
As the user clicks over the Data Model on the left, the Xpath will be automatically built.
The collection can also be filtered, to obtain for example, the Sum of all Approved Products. The last image returned the sum of ALL products.
Once the filter is set, the user should select the value of the collection to evaluate (if a sum, max, min, avg is required). When an attribute is selected, the filter will not be shown but the XPath will be filtered
When the Custom XPath is ready Click OK. In the main view drag and drop it to be evaluated in the box on the right.
When the Custom XPath is inserted, choose the evaluation condition from the drop down list. Then, select the condition.
Click Finish to save all changes.
Scripting Boolean
Some conditions to be evaluated in order to return True or False are more complex and cannot be done with the drag and drop interface described above.
Keep in mind that since Scripting Booleans accept any coding, it might happen that a true or a false is not returned. This should NEVER happen. Scripting booleans should ALWAYS return a true or a false.
The following is an example of the use of the scripting Boolean:
In a Purchase Request process, an applicant requests some products. The Request is then approved by the applicant's boss.
However, each user has an authorization level associated according to the total amount of the requests. Then, the transition condition must evaluate if the boss has o doesn't have the authorization level required to approve.
If the boss has the authority level, the process will continue. If the boss doesn't have the authority level, the case will be assigned to the boss' boss.
Clearly, the evaluation of the level of authorization is complex and cannot be done dragging and dropping attributes. Thus, a Scripting Boolean is required.
Check out the next video to learn how to create and use and scripting Boolean.
<videoflash>FpH37SD7rM4|640|505|</videoflash>
<comments />