The Validations button is found in the Table's Properties Advanced tab. When clicked, it displays a new window to create the table validations.
In the Table Validations window you can evaluate several conditions to ensure the data input and structure of the Table is correct.
Validations can evaluate counters, that count the number of records that comply with a condition in the table, or attributes directly.
Counters are variables used to obtain the number of rows that comply with given conditions. These are defined in the first section of the table validations window.
In the next image we used three counters to validate different business conditions in a table containing products quotations:
•The first Counter assigns the total number of rows in the Table to the NewCounter variable.
•The second Counter sets the variable NewCounter2 to the number of rows that meet a join condition, specifically if the Total price for a product is less than its Unit price. To do so, it compares the values of these attributes held in each record and counts the record if it meets the condition.
•The last counter is stored in the variable NewCounter3 and evaluates that each record comply with a single attribute condition, that is the number of records whose Unit price is less than 1,000.
You can also create multiple conditions by using AND\OR operators. The following counter takes into account the records whose total prices is less than the unit price OR those whose total prices is greater than 50000.
Additionally you can create groups of conditions by linking them using the Link ()option. The following counter only have into account the records whose total prices is less than the unit price OR those whose total price is greater than 50.000 AND less than 100.000.
Take into account that conditions defined for the counters are evaluated over all the existing records in the table. If you perform table validations over filtered tables you should include the filter conditions when defining counters as well.
In the lower section of the window (Validations) we define the validations to be performed. As we mentioned before these can be defined over attributes directly or using the counters defined in the top section.
When defined over attributes, validations will evaluate the whole column related to the attribute evaluated and will throw an error message if at least one of its records does not meet the given condition.
Direct validations apply to the whole column, they should not be used when you need to evaluate a condition that involves more than one column. In this case, all rows and all columns will be evaluated. For these cases you should use counters.
Validations can also evaluate multiple conditions and groups in the same way that counters.
In the image bellow the Table validation consists of four conditions: the first three conditions evaluate the Counters defined in the previous section, and the last one evaluates an attribute directly.
Given that the four validations are all defined as an OR condition, only one of the conditions needs to be true for an error message to display.
Additionally, you can create multiple validations independent of one another (i.e. each defined individually in separate Table Validations window) by clicking on Show multiple validations on the bottom left.
This will display a New button to create a new validation. Each separate validation can be accessed by the drop-down list at the top right of the window. The Table Validations window will show the first validation by default.
In a Purchase Request Process the Products Requested Table must comply with the following conditions:
•Contain at least one record.
•For all records, the Unit price must be less than the Total price (since Total price = Unit price x Quantity).
•For all records, the Unit price must be less than the 1.000 and the Total price must be less than 20.000.
We will create three independent validations, one for each condition.
Example using counters
The first example will contain a row counter. It will evaluate how many rows were found in the table and return an error message if there is less than one (that is, there are NO rows):
Example with direct Validations
The second example will contain a direct validation. Bizagi will evaluate if there are records where the Unit price is greater than the Total price, in any row of the table. If such record is found an error message will display:
Example using composed counters
The third validation will contain a row counter that evaluates two conditions. Then it will evaluate how many rows were counted and return an error message if there is at least one.