Validation rule example
The steps that follow describe how to import a validation rule file into Unica Plan, add it to a template, and test it.
Before you begin
numEmps
field in a grid is 10 - 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.
Procedure
- Create an XML file to contain the example validation rule.
- Upload the rules file into Unica Plan:
- Click Settings > Plan Settings > Template Configuration > Rules.
- Click Add Rules Definition.
- In the Update Rule dialog box, supply an identifying name and specify your XML file.
- Click Continue to add the rules file to Unica Plan.
- Assign the rules file to a tab on a template.
- Save your changes and use the template to create an object.
- To test the rule, enter invalid data in the empNum field.
For example, enter 5000. If you receive an error message, the rule is working as designed.