Validation rule example
The following example rule ensures that the value supplied for the numEmps field in a grid is from 10 to 1000.
<?xml version="1.0" encoding="UTF-8"?>
<validation-rules xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<rule validationType="ROW">
<name>Range Check</name>
<desc>Checks Range for numeric type. Note: for field numEmps</desc>
<class>com.unicacorp.uap.grid.validation.rule.basic.RangeCheckRule</class>
<enable>true</enable>
<applies-to-tvc-id>vendors</applies-to-tvc-id>
<set-property property="minValue" value="10"/>
<set-property property="maxValue" value="1000"/>
<set-property property="column" value="dyn_vendors.numEmps"/>
</rule>
</validation-rules>
In this rule, the numEmps field is on a form with an internal name of vendors. The procedure that follows assumes that you have this form set up on your system.
The steps that follow describe how to import a validation rule file into Marketing Operations, add it to a template, and test it.
1.
2.
Upload the rules file into Marketing Operations:
a.
Click Settings > Marketing Operations Settings > Template Configuration > Rules.
b.
Click Add Rules Definition.
c.
In the Update Rule dialog box, supply an identifying name and specify your XML file.
d.
Click Continue to add the rules file to Marketing Operations.
3.
a.
Click Settings > Marketing Operations Settings > Template Configuration > Templates.
b.
c.
Click Add Tab. For the Form, select vendors. For the Data Validation Rules, select the identifying name of your rule.
The system supplies the Data Validation Class when you select a rules file.
4.
5.
For example, enter 5000. If you receive an error message, the rule is working as designed.