Validation rules verify that the data in an imported record meets the data standards specified for the target system. Each validation rule includes an error message that is recorded in a validation report when the rule returns an invalid value. You can create a validation rule set and the individual rules that will make up that set.
A rule set has already been created called AutoGeneratedRuleSet and is auto-populated with rules when items are mapped. For example, if data is mapped to a property in the target system that is scoped by an integer, then an integer rule is auto-created.
Create a rule set
You must create a rule set and create two different rules to validate that the tag name is in the correct format, and that the maximum design pressure is within the required range.
-
Click Data Validator Administration > RuleSets and Rules.
-
In the RuleSets pane, click Create a new Rule Set .
-
In the Create New Rule Set dialog box, type a name and description for the rule set. You can name it Pump-RuleSet with a description of Validates the data in the Pump List.
-
Click Save.
Create a regular expression rule to verify the format of the Name property
This rule is created to verify that the tag names are in required format: NNNN-RP-NNN or NNNN-CP-NNN, where N stands for any number between 0 to 9.
-
Select the Pump-RuleSet.
-
In the Rules pane, click Create a new Rule .
-
In the Create Rule dialog box, type a name and description for the rule. You can name it CheckTagName with a description of A regular expression rule to verify the tag name is in the required format.
-
Select Class Definition from the Schema Type options.
-
Select Regular Expression from the Rule Type list.
-
Type *SampleTag* in the search box and press ENTER.
-
Select SampleTag from the Class Definition list.
-
Type Tag name is invalid in the Validation Rule Error Message box.
This message appears in the Validation report if the rule does not pass.
-
Select Error from the Validation Rule Severity Level list.
-
Click Next.
-
Type *Name* in the search box and press ENTER.
-
Select Name from the Property Definition list.
-
Type \d{4}-(RP|CP)-\d{3} in the Regular Expression box. This regular expression looks for tag names in the following format: 1234-RP-123, 1234-CP-123, 9999-CP-999, 1111-RP-111.
Use the ^ and $ symbols to restrict the data that is returned: ^\d{4}-(RP|CP)-\d{3}$. Otherwise, formats like 11234-RP-123 and 1234-RP-1234 will also pass the rule.
-
Click Next. View Summary, and check the details.
-
Click Finish to save the validation rule.
Create a Check Value and UOM rule to verify the value of the Design_Pressure_Max property
This rule is created to verify that the value of the maximum design pressure is within the range 15 to 28.
-
Select the Pump-RuleSet.
-
In the Rules pane, click Create a new Rule .
-
In the Create Rule dialog box, type a name and description for the rule. You can name it CheckDesignPressureMax with a description of A check value and UOM rule to verify that the design pressure maximum is within a required range.
-
Select Class Definition from the Schema Type options.
-
Select Check Value And UOM from the Rule Type list.
-
Type *SampleTag* in the search box and press ENTER.
-
Select SampleTag from the Class Definition list.
-
Type Value is not within the specified range in the Validation Rule Error Message box.
-
Select Error from the Validation Rule Severity Level list.
-
Click Next.
-
Type *SampleTag* in the search box and press ENTER.
-
Select SampleTag_Design_Pressure_Max from the Property Definition list.
-
Type 15 in the Minimum Value box.
-
Type 28 in the Maximum Value box.
-
Click Next. View Summary, and check the details.
-
Click Finish to save the validation rule.