Field formatting and validation
Field formatting and validation are available for both user-defined and predefined document types and are applied in the field properties.
Formatters always execute before validators. If a formatter fails, validation is skipped for that field. This execution order is important to understand when troubleshooting validation issues.
Formatting
Formatting enables you to take the extracted value and format it into something more useful than the original result.
For example, you process documents from all over the world, and date formats differ depending on the country. You want the date format to be the same no matter where the document originates. You can use a date formatter to convert all extracted dates to a globally recognized format of YYYY-MM-DD.
Some predefined document types already have formatting and validation. Most date fields are formatted for the document type locale. Dates on international documents are formatted to YYYY-MM-DD, and dates on USA documents are formatted to MM-DD-YYYY. To see what other fields have formatting, view the field details. If the original value differs from the extraction result on the Fields tab, formatting is applied to the extraction result.
If you apply formatting to a date field on a predefined document type that is already formatted, your formatter uses the already formatted value as input, not the original extracted value. For example, to format the StatementDate on a USA - BankStatements document so it outputs the date as MM/DD/YYYY instead, the date formatter must include the MM-DD-YYYY format in its "Ambiguous date formats" setting. Otherwise, the formatter does not recognize the input format and returns an error.
You can apply one formatter per each in one of the following ways:
- Global formatters:
-
Create global reusable formatters in Tungsten TotalAgility Advanced Studio and import them into DocAI Studio, or create them in the DocAI Studio by selecting . Use these formatters for date, amount, and percentage formats, or for predefined business rules. These reusable formatters are available for all solutions and all fields.
- Inline formatters:
-
Create field-specific formatting rules directly in DocAI Studio without creating reusable business rules. Inline formatters are available to all license tiers and are ideal for simple, non-reusable formatting logic. See Inline formatters.
Formatting is disabled for all tables in predefined document types.
Validation
Similarly, validation enables you to ensure that the data extracted for a field matches specific rules. For example, you can validate a customer ID that must be 12 characters long and contain numbers only.
You can apply one or more validators per field in the following ways:
- Global validators:
-
Create global reusable validators in Tungsten TotalAgility Advanced Studio and import them into DocAI Studio, or create them in the DocAI Studio by selecting . The validators created in DocAI Studio are restricted to date and regular expression validators only.
These validators are available in the global category when adding validators to a field.
- Field validation rules:
-
Field validation rules apply to a specific field in a document type and rely on predefined business rules. When you add field validators to a document type, single-field validators are added to the corresponding field automatically and appear in the local category for that field. Multi-field validators include two or more fields as part of their configuration, so DocAI Studio assigns the multi-field validator to those fields. Multi-field business rule validators are visible only in the list of field validators for a document type. See Add field validation rules.
- Inline validators:
-
Create field-specific or document type-level validation rules directly in DocAI Studio without creating reusable business rules. Inline validators are available to all license tiers and are ideal for simple, non-reusable validation logic. See Inline validators.
Validation is disabled for all tables in predefined document types.