Create a multi-field inline validator
Use the procedure in this topic to create an inline validator that validates relationships between multiple fields. Multi-field validators are applied at the document type level and require a minimum of two input fields. When the validator fails, all input fields are marked invalid.
For example, you can create a multi-field validator to ensure that the due date is greater than or equal to the invoice date, or that the gross weight is greater than the net weight.
Before you create a multi-field inline validator, verify that the document type has at least two fields.
- On the Fields menu, select a document.
-
Select a document to view its fields.
A list of fields configured for that document type are displayed in the Fields pane.
-
Select
Field validation rules.
The Field validation rules window is displayed for the selected document type and any existing validation rules are listed.
-
In the Validators section, select
Add a field validation rule.
A Validation rule list is displayed where you can select a local or global validator or create an inline validator.
-
Select the
edit icon next to the validator list.
The Inline validator window is displayed.
-
Configure the following settings.
Setting
Description
Name
Enter a unique and descriptive name for the validation rule. Names must be unique per document type. (Mandatory)
Inputs
Select the document fields that are validated by this rule. A minimum of two input fields must be selected before saving. Table fields cannot be added. (Mandatory)
To add fields, select and select the fields from the list. To remove a field, select it and select .
When you specify the fields, the system automatically applies the validator to all fields. You do not need to add the validator to field properties.
Condition
Define the rule for two or more fields that evaluates that all input fields are valid. Any field, field property, document property, or function can be used in the rule. (Mandatory)
To build the condition, right-click in the rule editor and select items from the menu, or use the operator buttons above the editor.
Failure
Select a message that is displayed to the user when a field fails validation. (Mandatory)
- Error message:
-
Enter the error message that is displayed if the validator fails.
- Error code:
-
Select an error code from the list. Manage error codes in the DocAI Studio menu or in Tungsten TotalAgility Advanced Studio.
-
Select Validate to check the condition for syntax errors.
If validation errors are found, correct them before proceeding. Syntax errors and type errors prevent saving.
-
Select Test to test the validator with sample values.
Enter sample values for the input fields and verify that the validator produces the expected valid or invalid result.
-
Select Save.
The Inline validator window closes and the validator is added to the list of validators with the type Inline.
The system automatically executes this validator during production for the specified fields. You do not need to configure the fields.
- Optional. Repeat the previous steps to add another multi-field validator.
-
Optional. To reorder validators in the list, use the and icons.
Validators execute in the order displayed. A validator only executes if all preceding validators have passed.
-
Select Save.
The field validation rules window for the selected document type closes and you are returned to document type fields.
- Optional. Save your solution.