# Fielding

The Fielding tab provides a graphical means of creating and editing the Field String and Field Definitions arguments of the OCRMax function. The resulting values are inserted into the function as literal strings.

Fielding provides the functionality to verify and correct strings, returning the set of best matching valid strings. There are two primary usages for Fielding:

- OCR result verification, where the string returned is determined to be correct or not based on the Field String and Field Definitions parameters.
- OCR result correction, where the string returned is not among the list of acceptable results, and an attempt is made to find an acceptable string allowed by the field that is closest to the returned string.

A typical use-case for fielding is when the string contains prefix and/or suffix characters, and fielding is used to ignore those prefix/suffix characters. In this case, the Field String and Field Definitions determine the offset of the string position in the ROI.

#### Field String

Specifies the number of characters contained in the character string. A Field String entry can be any alphanumeric character found in the text entry dialog, including (A to Z), (a to z), (0 to 9), dashes (-), dots (.), and spaces ( ).

Each character in the Field String corresponds to an indexed field position between 0 and 31. The Field String must contain at least the same number of positions as there are characters in the string for the read to pass (i.e. if there are 10 characters present, but the Field String only specifies 9 characters, the best matching 9 will be returned; however, if there are 8 characters present and the Field String defines 9 characters, the function will return #ERR). By default, each position in the Field String is represented as an asterisk (*) character, or alphanumeric "wildcard." This means that any character is valid at any position in the string.

However, an individual position in the Field String can be limited to consider only a subset of possible characters at that position. This increases overall performance and reliability because characters that are not possible at a position will not be considered during a read.

The pre-defined Field String entries are:

Field String Entry | Description | Valid Characters
* | Wildcard | Any trained character in the font.
N | Numeric | 0123456789
A | Uppercase alphabetical | ABCDEFGHIJKLMNOPQRSTUVWXYZ
a | Lowercase alphabetical | abcdefghijklmnopqrstuvwxyz
H | Hexadecimal, uppercase alphabetical and numerical | 0123456789ABCDEF
h | Hexadecimal, lowercase alphabetical and numerical | 0123456789abcdef
O | Octal | 01234567

Field String Example 1

If the Field String is **********AN, any character in the font is valid in the first 10 Field String positions. But in the 11th position, only uppercase alpha characters will be considered during the read. And in the 12th position, only numeric characters will be considered.

Field String Example 2

The font contains only numeric characters 0-9 and /. If the Field String is NN/NN/NN, only numeric characters will be considered in the first and second, fourth and fifth, and seventh and eighth positions. Only the forward slash (/) character will be considered in the third and sixth positions.

But if the Field String is NN/NN/AA, the read would return #ERR because the font does not contain any alpha characters.

#### Field Definitions

Optionally, the Field Definitions settings can be used to create user-defined entries for the Field String. When included in the Field String, these entries restrict the list of valid characters at the positions in which they are inserted. There are several pre-defined field definitions, and user-defined field definitions can be added. The pre-defined definitions are displayed in grey text and may not be deleted or edited, only enabled or disabled. User-defined definitions are displayed in black text, can be added, deleted or edited. To add a field definition, press the Add New button, assign an icon for the Character and then assign a definition to the Character.

Note:

- The number of user-defined definitions is limited by the OCRMax function's expression length (249).
- Any user-defined definitions that are disabled when the OCRMax property sheet is closed will be removed and will not be available when re-opening the function's property sheet.
- If the Field Definitions parameter in the General tab is defined as Cell References, the Field Definitions option in the Fielding tab will be disabled, and the current value of the cell reference will be displayed.

Characters listed for a Field Definitions entry must be contained in the font. For example: #=123 is valid if 1, 2, and 3 are included in the user-trained font. However, #=123 would be invalid if 1, 2, and 3 are not included in the font.

Note: Using one of the predefined entries (*, N, A, a, H, h, O) in the Field Definitions parameter will remap the list of valid characters in the new definition.

Field Definitions Example 1

If the value of Field Definitions is #=123;$=3456;%=789, and the Field String is #$%*******, then the only characters that will be valid in the first position will be 1, 2, or 3. The only valid characters in the second position will be 3, 4, 5, or 6. And in the third position, only 7, 8, or 9 will be valid. Any character in the font is valid in the fourth through tenth positions.

Field Definitions Example 2

If the value of Field Definitions is #=123;$=3456;%=789, A=A, and the Field String is #$%******A, then the only characters that will be valid in the first position will be 1, 2, or 3. The only valid characters in the second position will be 3, 4, 5, or 6. And in the third position, only 7, 8, or 9 will be valid. Any character in the font is valid in the fourth through ninth positions. Only the A character will be considered in the tenth position because the Field Definition A=A remaps the predefined Field String entry.

#### Field String Parameters

- Match Only Against Characters in Field String: Specifies whether or not the function will only attempt to match characters against characters indicated by the Field String.

Note: When the Inspection Mode is set to Read/Verify, this parameter will field against the text string specified in the Match String parameter.

- Variable Length Strings: Specifies whether or not the defined Field String might be a sub-string within the complete read text string. If a sub-string is found, it will return the best-match sub-string.

Note: If the External Settings parameter is set as a reference to an OCRMaxSettings function, the Match Only Against Characters in Field String and Variable Length Strings parameters will be disabled.

- Minimum Length: When the Variable Length Strings parameter is enabled, this parameter specifies the minimum acceptable string length (0 - 100; default = 1).
- Maximum Length: When the Variable Length Strings parameter is enabled, this parameter specifies the maximum acceptable string length (0 - 100; default = 100).
- Maximum Start Index: When the Variable Length Strings parameter is enabled, this parameter specifies the fielding subsequences to be considered, which must start at a position that is no greater than this index value (0 - 100; default = 100).
- Minimum End Index: When the Variable Length Strings parameter is enabled, this parameter specifies the fielding subsequences to be considered, which must end at a position that is no smaller than this index value (0 - 100; default = 0).