beautypg.com

Step 1: check number of matches, Step 2: output to a field, Chapter 5 – Kofax INDICIUS 6.0 User Manual

Page 78: Getting started guide (free-form)

background image

Chapter 5

72

Getting Started Guide (Free-Form)

'*** Search: Date ***

'Get the number of matches. There are always the same number of anchors and targets.

lMatches

=

Textread.GetNumberOfMatches

("MCTarget_Date")

If

lMatches = 1

Then

'Set the value in the output field (confidence etc are preserved)

lret

=

Textread.CreateXMLFieldFromMatch

("MCTarget_Date", 1, "Date",

False

,

False

)

If

lret < 0

Then

Recog.LogMessage

"TextRead.CreateXMLFieldFromMatch failed. Error code: " & lret, 1

AnalyseAndOutputMatches

=

lret

Exit Function

End If

ElseIf

lMatches > 1

Then

'Set the value in the output field from the first match, but reject it

lret

=

Textread.CreateXMLFieldFromMatch

("MCTarget_Date", 1, "Date",

False

,

True

)

If

lret < 0

Then

Recog.LogMessage

"TextRead.CreateXMLFieldFromMatch failed. Error code: " & lret, 1

AnalyseAndOutputMatches

=

lret

Exit Function

End If

End If

Figure 5-31. Code Block in the AnalyseAndOutputMatches Function

There are two steps within each of these blocks of code:

Step 1: Check number of matches.
Step 2: Output to a field.

Step 1: Check Number of Matches

The function checks the number of matches found in the “MCTarget_Date”
collection. This will be the same as for the “MCAnchor_Date” collection. (For a target
search the anchor collection will only have blank entries, for an anchor-target search
the targets may be blank.)

Step 2: Output to a Field

If a single match is found, the value is output from the target collection to the field
called “Date.”

If multiple matches are found, the first value is output from the target collection to
the field called “Date”, and the value is flagged as unconfident so it requires
reviewing in Completion.

Note

It is possible to output the match value as a field with the same name as the

search, a field with an alternative name, the document type or the document type in
a field. By changing the value of the Output Type property (on the Main panel) for
each search, the script code for all these options can be automatically configured and
inserted. For further information, refer to the How to Configure Recognition book in
the INDICIUS Help.