Create a single-field inline validator
Create an inline validator for a single field. The validator can reference other fields, field properties, document properties, and functions in its condition expression. When the validator fails, only the field where it is defined is marked invalid.
For example, you can create a single-field validator to ensure that a customer ID is 12 characters long and contains only numbers, or to validate that a total amount matches the sum of line items.
The input to a single-field inline validator is always the selected field and cannot be changed. The validator remains bound to the field on which it was created.
Use inline validators alongside global and field validation rules. The validators are processed in the order they are listed.
Before you create a single-field inline validator, verify that the field exists on the document type.
- On the Fields menu, select a document type.
-
Select the menu for a field, then select Properties.
The field properties are displayed on the right.
- Select the Validation tab.
-
In the Validators section, select
Add field validator.
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 field. (Mandatory)
Condition
Define the rule for a field to evaluate when it is valid. Conditions may reference other fields, field properties, document properties, and supported built-in functions. Conditions can use AND/OR operators. Multiple conditions can be grouped into a single 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 you saving your validator.
-
Optional. Select Test to test the validator with sample
values.
Enter enter a sample into the Value field and select Run Test.
Test rules with a variety of sample values, including edge cases and invalid inputs.
The result of the validator is displayed.
If you are happy with the results, select Close. Otherwise, test again or edit your validator.
-
Select Save.
The Inline validator window closes, and the validator is added to the list of validators with the Inline type.
This helps differentiate inline validators from global and field validation rules.
-
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.
-
Optional. Delete an inline validator by selecting it and then .
The inline validator is removed from the list of validators.
-
Select Save in the field properties.
Extraction is performed for your training document, and the validator is applied. If the validator fails, the validation message is displayed when you move the pointer over the field on the image or its extraction data circle.
- Optional. Select Save your solution.