Create a conditional inline formatter
Create a conditional inline formatter that applies different format expressions based on conditions. Conditional formatters are useful when you need to format a field value differently depending on the values of other fields or document properties.
For example, you can create a conditional formatter to format a date field differently based on the document type or country code.
Conditional formatting rules are evaluated in the order they are displayed. The first matching condition is applied, and the remaining rules are skipped.
If no conditions match in a conditional formatter, the field value is not formatted and the field remains valid. Ensure that your conditions cover all expected scenarios, or add a final rule with a condition that always evaluates to true to handle any remaining cases.
Before you create a conditional inline formatter, verify that you have completed the following.
-
The field exists on the document type.
-
The field does not already have a Simple formatter applied. One field can have only one simple formatter, but multiple conditional formatters.
- On the Fields menu, select a document, then 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 rule editor panel is displayed in the field properties window.
-
For Formatting, select Conditional.
The Conditional rules section is displayed.
-
In the Conditional rules section, select
Add.
The Conditional formatting window is displayed.
-
Configure the following settings.
Setting
Description
Name
Enter a unique and descriptive name for the conditional formatting rule. (Mandatory)
Condition
Define the condition that must evaluate to true to apply this formatting. You can reference other fields, document properties, and functions in the condition. (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.
Refer to the Tungsten TotalAgility Advanced Studio Help for details about the rule editor.
Format
Define the formatting rule that is applied when the condition is true. You can reference other fields, document properties, and functions in the format expression. (Mandatory)
To build the format expression, 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 formatting fails. (Mandatory)
- Error message:
-
Enter the error message to display if the formatter 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 expressions for syntax errors.
If validation errors are found, correct them before proceeding. Invalid validators cannot be saved.
-
Select Test to test the conditional formatting rule with sample
values.
The Test inline formatter window is displayed.
-
Enter sample values for each required field and select Run
Test.
The test verifies that the formatter produces the expected output when the condition is true.
The formatted text is displayed. If the value is as expected, select Close. Otherwise, adjust the rule and test again.
-
Select Save.
The Conditional formatting window closes and the rule is added to the Conditional rules list.
-
Optional. Repeat the previous steps to add more conditional formatting
rules.
Rules are evaluated in the order they are displayed.
- Optional. To edit a rule, select it in the list and select . Alternatively, double-click on the rule.
- Optional. To delete a rule, select it in the list and select .
-
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.
- Optional. Select Save your solution.