Skip to main content
This article provides sample scripts for common custom-rule scenarios in ABBYY FlexiCapture. Where applicable, each example includes both a VBScript and a JScript version.

Automation rule

This example demonstrates a table data check. The rule checks whether the table data matches the value in the resulting field. The table has columns with the prices and quantities of goods. The rule is written at the level of a section containing the table and the resulting field.

Code of an ActiveX component

The code below is the CheckDoc class code from the AutomationRule project, used in the scripts above.

Search in the variants list

This rule checks whether the field value matches one of the values in a list. If it does not, a rule error flag appears, and the field is given a list of suggested values. Depending on the check result, the field is marked as confidently or not confidently recognized.

Field match check

This rule checks whether the field has been matched.

Checkmark check

This rule checks whether the checkmark is selected.

Checkmark group check

This rule iterates over all the checkmarks in the group and, if none are selected, selects the first one. The rule is written for the checkmark group level. All the checkmarks in the group have been added to the list of fields included in the rule, and the group itself has been excluded from the list. For the default checkmark (the first one), the ReadOnly flag has been disabled. If there are no checkmarks in the group, a rule error flag is enabled. This sample iterates over all the fields included in the rule. Since field names are not specified, the code can be used for any checkmark group.

Field reliability check

This rule checks the number of uncertain characters in the field and clears the field if that number is three or more. This is an Autocorrection script.

Character replacement without losing regions and verification flags

The script replaces + with & without losing information about regions and verification flags. This is an Autocorrection script.

Batch integrity check

Checks whether the number of documents specified on the control page matches the batch inventory and the number of documents actually processed. If the numbers do not match, an error is returned.

Counting the number of documents and pages in a document set

This script counts the number of documents and pages in a document set and throws an error if the set contains an element of an unknown type.

Address parsing

The script parses the address into the following components: ZIP Code, Country, City, and Street. It is called on a portion of the source field.