Create a simple inline formatter
Use the procedure in this topic to create a simple inline formatter that applies a single format expression to a field value. Simple formatters are useful when you need straightforward formatting logic that does not depend on conditions.
For example, you can create a simple formatter to add hyphens to a social security number field, converting 123456789 to 123-45-6789.
Before you begin, verify that:
-
The field exists on the document type.
-
The field does not already have a formatter applied. One field can have only one formatter.
- On the Fields menu, select a document and select a field.
-
Select the field's menu and select Properties.
The field properties are displayed on the right.
-
In the Formatter section, select the
Edit inline formatting rule next to the formatter
list.
The formatter rule editor is displayed.
-
Configure the following settings.
Setting
Description
Formatting
Select Simple. (Default: Simple)
If you want to use a conditional formatter, see Create a conditional inline formatter.
Format expression
Define the formatting rule. You can reference other fields, document properties, and functions in the expression. (Mandatory)
To build the expression, right-click in the rule editor and select items from the menu, or use the operator buttons above the rule editor.
Refer to the Tungsten TotalAgility Advanced Studio Help for details about the rule editor.
Failure
Select a message that is displayed to the user when formatting fails. (Mandatory)
- Error message:
-
Enter the error message that is displayed if the formatter fails.
- Error code:
-
Select an error code from the list. Error codes are managed in the DocAI Studio menu or in Tungsten TotalAgility Advanced Studio.
-
Select Validate to check the expression for syntax errors.
If validation errors are found, correct them before proceeding. Invalid formatters cannot be saved.
-
Select Test to test the formatter with sample values.
The Test inline formatter window is displayed.
-
In the Test inline formatter window, 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 formatted text of your test is displayed.
If you are happy with the results, select Close. Otherwise, test again or edit your formatter.
-
Select Save in the field properties.
Extraction is performed for your training document and the formatter is applied. Use the extraction data circle tooltip or the extracted value on the image to view details about the extracted and formatted values.
Once an inline formatter is added to a field, the rule editor panel is displayed in the field properties.
-
Optional. To delete an inline formatter, select
Close inline formatting rule panel.
The configured rule is removed and the rule editor panel is closed.
- Optional. Select Save the solution.