Validation rules
The validator works by invoking a series of rules, and comparing the input data against the rules. Each rule is an executable Java file that implements the Rule interface.
The validation plug-in supports two types of rules.
*
*
All the rules are fired when the grid data is saved. However, all row-level rules are fired first, and then grid-level rules are fired. Rules are fired in the order they are declared in the rules file.
Data validation rules file structure
A validation rules file is an XML file containing one or more rules. Each rule can contain the following tags.
*
false: the rule is disabled
*
true: the rule is enabled
The Java class containing the commands for processing the rule. To use the sample range check rule, you enter: com.unicacorp.uap.grid.validation.rule.basic.RangeCheckRule
IBM® Operações de Marketing ships with four sample rule types.
This rule checks the Name field (stored in the dyn_vendors database table) to make sure that it begins with the letter A. Class name: com.unicacorp.uap.grid.validation.rule.basic.BeginsWithRule
Ensures the column being validated does not contain duplicate values. Set the column property. Class name: com.unicacorp.uap.grid.validation.rule.basic.UniqueCheckRule
This rule checks the numEmployees field (stored in the dyn_vendors database table) to make sure that it is between 1 and 999,999. Class name: com.unicacorp.uap.grid.validation.rule.basic.RangeCheckRule
This rule checks the invoiceDate field (stored in the dyn_vendors database table) to make sure that it is not before the year 2000. Optionally, you can set the dateFormat property. If you add this property, dates must be entered in the specified format. You can set the following format values: dd/MM/yyyy, MM/dd/yyyy, dd/MM/yy, MM/dd/yy, yyyy-MM-dd, yyyy.MM.dd Class name: com.unicacorp.uap.grid.validation.rule.basic.DateCheckRule
Validation rule example