Minimum value using expressions

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Process wizard > Business Rules > Business rules examples > 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 on 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