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 begin

Before you create a single-field inline validator, verify that the field exists on the document type.

Procedure
  1. On the Fields menu, select a document type.
  2. Select the menu for a field, then select Properties.

    The field properties are displayed on the right.

  3. Select the Validation tab.
  4. 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.

  5. Select the edit icon next to the validator list.

    The Inline validator window is displayed.

  6. 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 Settings > Error codes menu or in Tungsten TotalAgility Advanced Studio.

  7. 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.

  8. 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.

  9. 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.

  10. 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.

  11. Optional. Delete an inline validator by selecting it and then .

    The inline validator is removed from the list of validators.

  12. 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.

  13. Optional. Select Save your solution.