Rules offer an additional means of checking captured data. You can use rules to specify certain restrictions that apply to the data in particular fields (or, to put it another way, conditions to be met by the values captured from particular fields).
Additionally, you can use rules to process captured values. For instance, you can merge values from multiple fields, or substitute captured values by values taken from a database.
You can specify how strict a rule is, i.e. whether it should issue a warning or an error if it is violated. Fields with rule warnings will be marked with a yellow flag and fields with rule errors will marked with red flags. See Rule validation for details.
Rules are set up on the Rules tab of the properties dialog box of a field, section, Document Definition or another item for which rules can be specified.
Use the Show rules drop-down list to choose which kind of rules to display:
- refer to %0 Shows only the rules that refer to the current object.
- owned by %0 Shows only the rules that are stored in the current object.
- owned by %0 and its children Shows only the rules that are stored in the current objects and its child objects (e.g. if the object is a group, the rules stored in the group will be shown together with the rules stored in fields that are part of the group).
Note: In the rule display options above, “%0” will be replaced by the name of the current object.
Note: A new rule can be created if you choose to show rules owned by %0 and owned by %0 and its children. You cannot create a new rule if you select rules that refer to %0.
You can filter the list of rules in order to make it easier to manage. For example, you may choose to display only rules that involve a specific field, or rules that are triggered by a specific condition.
To open the Filter dialog box, click the Filter button on the Rules tab.
The following filtering criteria are available:
- Rule name contains Filters rules by name (select a desired name from the drop-down list).
- Field Filters rules by field (select a field to show only rules that make use of this field).
- Apply rules This group of options filters rules according to whether they have a condition that must be met before they are executed, and by these conditions. Select the Always option if you only want to see rules that are always executed, i.e. don't have a condition that triggers them. Select If this condition is true if you want to see rules that are triggered by one of the following conditions:
- Belongs to set (exact-match) Shows only rules whose allowed field values (i.e. those values that trigger the rule) are exactly the same as those specified in the filter.
- Does not belong to set (exact-match) Shows only rules whose prohibited field values (i.e. those values that do not trigger the rule) are exactly the same as those specified in the filter.
- Is empty - Shows only rules which are applied if the field value is empty.
- Is not empty Shows only rules which are applied if the field value is not empty.
- Overlaps with set - Shows only rules whose allowed field values (i.e. those values that trigger the rule) contain at least one of the values specified in the filter.
Specifying multiple filtering criteria will show only those rules that meet all of them.
When you specify filtering criteria, they are displayed as a text string next to the Filter button. To clear the filter, click . When you clear the filter, all the rules are shown. The filter is cleared automatically when you close the Rules dialog box.
Example of using the filter
Suppose you have set up the following two rules:
- FirstRule is applied if Currency = EUR, USD
- SecondRule is applied if Currency = EUR, RUR.
The table below illustrates which rules will be displayed for different filtering criteria.
|Rule condition||Set of values||Displayed rules|
|Belongs to set (exact-match)||EUR, USD||FirstRule|
|Does not belong to set (exact-match)||EUR||...|
|Overlaps with set||EUR||FirstRule, SecondRule|
|Overlaps with set||EUR, XXX||FirstRule, SecondRule|
Setting up rules
The list of rules contains all rules that have been set up and some additional criteria of each rule.
To create a new rule, click the New Rule... button on the Rules tab. In the dialog box that opens, select the type of rule you want to create and click OK. This opens the New Rule which contains the following options:
- Name - The name of the rule.
- Show rule name in message to verifier - Enable this option if you want error notifications to contain the name of the rule that yielded the error. By default, notifications about rule errors appear as follows: "name of rule: error message". If this option is disabled, the notification will only contain the error message.
- Severity - The severity of the rule. When a rule yields an error, an error message and a flag are generated. There are two possible flags: Error or Warning types.
When an attempt is made to export documents with rule errors, a notification about this will be displayed. Documents with rule errors can still be exported
Note: This option is not available for rules of the Calculate Sum and Merge Fields.
- Apply rule - Options in this group let you determine when a rule is applied.
- Always The rule is always applied, i.e. it will be applied whenever changes are made to the fields monitored by the rule. This option is enabled by default.
- If this condition is true If this option is enabled, the rule will only be applied when certain conditions are fulfilled. For details, see the Conditions for applying rules section of this article.
- Tags are used for filtering rules.
Note: Use commas without spaces to separate values. Tag values are case-sensitive.
- Enabled rule - Enables or disables the rule.
The following options depend on the rule's type:
- Calculate Sum Calculates the sum of the values of several fields and writes it to another field.
- Check Sum Calculates the sum of the values of several fields and checks it against a pre-defined number or the value of another field.
- Compare Fields Compares the values of several fields.
- Database Check Checks captured values against their counterparts taken from a database.
- Merge Fields Merges the values of several fields. You can add any type of separator when merging field values into one.
- Script A user-defined script that describes restrictions that apply to specific data.
- Sum in Figures - Sum in Words (Russian) Compares a sum written in words with the same sum written in digits (works only on Russian-language texts).
Note: If a rule is set for a repeating field group, it will be applied field-by-field to each group instance individually. If a rule is set inside a group, then that rule will be applied only to that particular group instance.
In the current version of ABBYY FlexiCapture, rules can be triggered when a certain field has a specific value. When you create or edit a rule, you can specify when you want the rule to be applied by selecting the Always or If this condition is true option. If you want to specify a condition that triggers the rule, select the If this condition is true option and then click the Edit button to the right of this option to open the Condition for Applying Rule dialog box. In this dialog box:
- Select a desired field.
- Select the condition that must be fulfilled to trigger the rule.
- Belongs to set The rule will be applied if the value of the field matches one of the allowed values you specified.
- Does not belong to set The rule will be not applied if the value of the field matches any of the prohibited values you specified.
- Is empty - The rule will be applied if the field value is empty.
- Is not empty - The rule will be applied if the field value is not empty.
- You can also specify a range of possible (permitted) values of a field.
- To add a value to the set of possible values, type in the value and click Add. To delete a value from the set, select the value and click Delete. You can also add an empty value to the set of possible values. To add an empty value, click Add without typing any values. The empty value will appear as in the set of possible values. A value can be added only once.
Conditions for applying rules can only involve text fields (including fields with continued regions), barcodes, and table columns. Conditions for applying rules cannot involve checkmarks, checkmark groups, fields with multiple instances, images, or table cells.
Important! If the Show on verification option is not enabled in a field's properties, errors related to this field will not be displayed during verification. This means that the document with this field will have an error flag that cannot be removed.
Rule chains are groups of rules with a specific order of application. This lets you set up several rules that involve the same field.
To create a rule chain:
- Click the Chains button in the Rules tab.
- In the dialog box that opens, click the New Chain... button.
- Provide the name of the rule chain and a comment (optional).
- Click OK.
The new rule chain will be displayed in the list in the Chains dialog box. Next, add rules to the rule chain. To do so:
- Click the Add Rule... button.
- Select the desired rules.
- Use the Move Up and Move Down buttons to arrange the rules in the order you want them applied.
Important! Each rule can only be a part of one chain.
Note: If you try to add a field that can be edited - the Read-only option is disabled in its properties to a rule, but this rule is already involved in a chain of rules where it can also be edited, you will be prompted to merge this rule with the chain of rules. If you agree to do so, and the rule to which you added the field belongs to another chain, the two rule chains will be merged into one.
Where rules are stored
Rules are stored at the level of the item where they were created. This can be a field, a section, or the Document Definition itself. In most cases, it will not matter where the program stores the rules. However, if your Document Definition is fairly complex and has multiple field groups or recurring elements, be sure you know where each rule is stored. For instance, if you have a group of fields and some of its fields are subject to a particular rule, be sure to store this rule in the group or in one of its fields. Otherwise, when you create a new instance of the group, the rule will not be copied or applied to the new instance. In the properties dialog box of an item, you can see the rules that refer to the item, the rules owned by (i.e. stored in) the item, or the rules owned by the item and its children. Use the Show rules drop-down list to choose which kind of rules to display.
When documents are processed automatically, rule validation errors are by default reported in the UI language of the Processing Station component (i.e. the language that was selected when installing ABBYY FlexiCapture).
However, some operators may prefer to see error messages in a language other than the default language (for example, if manual and automatic processing are carried out in different countries).
To specify different languages for different operators, create a separate batch type for each language. In each batch type, specify the language to be used for error messages issued during automatic processing:
- On the Project Setup Station, click Project > Batch Types…
- Create a new batch type (or select an existing batch type and click Edit...).
- On the Verification tab, select Use this language for messages issued during processing.
Rule validation errors can be reported in any of the following languages:
- Chinese Simplified
- Portuguese (Brazilian)
- Save your changes.
Note: If an operator makes corrections which are then immediately checked by validation rules, any error messages issued by such repeat checks will be displayed in the ABBYY FlexiCapture UI language. This is because all such processing is done locally rather than on the Processing Station. This applies to all error messages on desktop stations and format errors on web stations.
Important! The following types of error messages are only available in English: errors reported by script rules, document assembly errors, and key field matching errors.