It is a common requirement to validate a numeric input against a minimum and/or maximum value; specifically, in Bizagi, for the Number, Money or Date controls.
To accommodate this need, Bizagi provides Minimum and Maximum properties.
The Minimum and Maximum value properties are found in the Advanced tab of the control's Properties.
For these properties, the values can be set by entering text, selecting a value or associating an expression. The value, set by any of these methods, will display in the property's description area.
If the end user input does not fall within the range of minimum and maximum boundary values, a validation will display.
If you are using an expression, its name will be displayed on the left. If the name is too long to fit in the box, hover with the mouse, a tooltip with the complete name will display.
Example: Define minimum and maximum boundary values for a Money Control
In a Credit Request Process the amount to be requested must be at least a 100 US dollars. Also, the maximum amount allowed is ten times the monthly income of the applicant.
In the Credit Request Process Entity, the Monthly income and the Requested Amount property values are stored in the attributes with the same name.
1. In the Forms Designer, go to the Requested Amount control Properties and open the Advanced tab.
2. In the Minimum property type the value of 100.
3. Select the Maximum property and click the expression icon () in order to associate an expression.
4. In the expression module define the maximum threshold based on the monthly income.
The expression in this example would be: <CreditRequest.MonthlyIncome>*10;
Save the expression and close the Form.
5. Proceed to test your validations in the Work Portal.
Enter a value lower than a 100 in the Requested Amount Control. When clicking Next, a validation message will display, as shown in the image below.
Now enter a value higher than ten times the monthly income of the applicant. When clicking Next, the following message will display as shown in the image below.
Example: Define minimum and maximum boundary values for the Date Control
In a Vacation Leave Request Process an employee must request the vacations at least 15 days in advance. In addition, a stipulation exist whereby requests submitted after December 30th (2012) will not be processed.
The official working day on which the vacation commences is stored in the attribute Leaving Date, within the Vacation Request Process Entity.
1. In the Forms Designer, select the Properties of the Leaving Date control and open the Advanced tab.
2. In the Maximum property select the December 30th entry from the calender.
3. Select the Minimum property and click the expression icon () in order to associate an expression.
4. In the expression module define the minimum value allowed (15 days in advance) according to the current date.
The expression in this example would be:
Save the expression and close the form.
5. Go to the Work Portal to test the validations. Try to enter a date after December 30th. Note that this cannot be done as all days that fall after the boundary date are disabled (in this example the 31st). In addition, the next month icon () is disabled.
Now try to enter a date between today and two weeks thereafter (suppose the current day is 5/05/2016). Again, note it is not possible.