Boolean, While and If elements

<< Click to Display Table of Contents >>

Navigation:  Low-code Process Automation > Studio Cloud - Authoring environment > Bizagi Studio > Process wizard > Business Rules > Business rules elements >

Boolean, While and If elements

Overview

Boolean, While and If elements are aimed to perform different tasks but share a similar user interface because they all evaluate a condition where an action is performed or a result returned.

 

The condition is entered in the Expression window where three things are required:

To set the variable on the left side of the conditional assignment, select the relevant attribute of the data model, write an expression or select a value form the existing vocabularies.

Once the element to be evaluated has been selected, enter the operator that will be used.

Depending on the type of attribute evaluated, the system will display a list of operators:

 

ATTRIBUTE

OPERATOR

Numerical (integer), currency and dates (applies to related entities relationships)

Equal to, Different to, Less than, Less than or equal To, Greater than, Greater than or equal to, Is blank, Is filled.

Text

Equal to, Different to,  Is blank, Is filled, Contains, Does Not Contain, Begins with, Does not begin with

Boolean

Equal to, Different to, Is blank, Is filled, Is true, Is false

 

Then, on the right side of the conditional assignment, enter the value to make the comparison.

If the selection requires the inclusion of another argument, another combo will appear offering options based on the attribute (first element) selected.

 

You can combine several conditions. If you need to add another condition, the And button allows you to include it by means of a logical operator "And" or "Or".

 

BusinessRulesElements22

 

Boolean element

This element returns True or False according to the condition entered.

 

The following image shows a Boolean expression that returns true if the Request Status' code is 3. Otherwise it returns false.

 

BusinessRulesElements23

 

While element

This element executes a cycle as long as the condition is true.

Make sure the condition evaluate to FALSE at some point so there is no possibility of generating a never-ending loop.

 

In a Purchase Request process, after the request has been approved it is necessary to include a certain number of quotations. This number has been previously defined. We will use a rule to create the Quotations records automatically, so the end user only needs to fill in Quotations, without worrying how many there should be. Using a While element we will add the records until the defined number has been reached.

1. Create the expression On Exit of the Approval Activity.

2. Create a variable to save the number of records that are being added.

 

BusinessRulesElements24

 

3. Create the While element. The condition will be: as long as the number of Required Quotations is greater than the number of Quotations included, add one more record:

 

BusinessRulesElements25

 

4. Create an expression element to add the records to the collection.

In this element we will also add ONE to the variable that controls the number of records included. When this number reaches the number of quotations required, the cycle will end and the rule will finish (to add ONE you can type ++ in front of the attribute) .

 

BusinessRulesElements26

 

If element

Offers the possibility to select one of several paths by means of conditionals.  The Else path will always be established.

 

Imagine you work for a Vehicle insurance company.  As an underwriter in the company you analyze the Policies, and according to the risk analysis establish whether the vehicle can be covered or not.

Based on your decision, the vehicle request status must be updated to "Rejected" or "Authorized by Risk".

The following is the data model of this example:

 

BusinessRulesElements27

 

1. Create a rule On Exit of the Activity where the Risk is evaluated.

 

2. Add an If element and select the condition. In this case select the path if the Approve Risk attribute is true.

 

BusinessRulesElements28

 

3. Include Assignment elements to set the Status of the Vehicle.

Note that this is done using the Entity option to set the correct status using the code.

In the Else option, the status has code 5 for "Rejected by Risk".

 

BusinessRulesElements29


Last Updated 1/6/2022 11:36:12 AM