Minimum value using expressions

<< Click to Display Table of Contents >>

Navigation:  Low-code Process Automation > Studio Cloud - Authoring environment > Bizagi Studio > Process wizard > Business Rules > Business Rules examples > Cases and activities > Managing user interface >

Minimum value using expressions

The following example illustrates how to set a minimum value for a control.

 

Suppose a Transportation and Logistics company has defined a process called Shipping Process, to manage and monitor international shipments. The first task of this Process allows the customers to enter the information and estimate the cost of the shipment.

The company provides shipping services between Brazil, Ireland and United States. Transportation of goods can be by air, land, or sea. If the selected means of transport is air, an express service is offered for same-day shipping and delivery.

 

The data capture form to collect this specific information is as follows:

 

ManagingUserInterface

 

The earliest date (minimum value) a customer can request for a shipment is the current date. Use an expression to validate the given date.

 

1. Click on the Shipping Date control to display its Properties in the Left panel.

 

ManagingUserInterface25

 

2. Select the Expression icon in the Minimum Date range property of the Advanced tab,

 

ManagingUserInterface26

 

Click New to create a new expression.

 

ManagingUserInterface51

 

3. In the new window, right click the vertical line of the rule and add an expression module.  

 

ManagingUserInterface27

 

4. Type the following sentence and save the expression.

This expression will return today's date and assign it to the shipping date as a minimum value.

 

ManagingUserInterface28

 

//Returns today date

DateTime.Today;

 

5. Test the expression in the Work Portal. Notice that in the Shipping Date calender the days (and months) preceding the current date are disabled.

 

ManagingUserInterface29

 

note_pin

Keep in mind that the type of value returned in the expression must coincide with the type of value that the control manages (e.g dates with dates, integer with integer). If they are different, errors may occur in the execution of the form.

 


Last Updated 1/23/2023 12:05:09 PM