Chapter 5, Getting started guide (free-form), Svalue = mid (svalue,3) – Kofax INDICIUS 6.0 User Manual

Page 66

Advertising
background image

Chapter 5

60

Getting Started Guide (Free-Form)

Function

MatchValue_Format(sSearchName, sValue)

Dim

lRet

Select Case

sSearchName

Case

"Date"

'Convert the date to MMDDYYYY format

'The date (sValue) is reformatted within the function and returned as sValue

'If lRet is < 0 an error has occurred

lRet

=

LibFreeForm_FormatDate(sValue)

If

lRet < 0

Then

Recog.LogMessage

"LibFreeForm_FormatDate failed. Error code: " & lRet, 1

MatchValue_Format

=

""

Exit Function

End If

MatchValue_Format

=

sValue

Case

"AccountNo"

'Insert formatting for search 'AccountNo' here...

MatchValue_Format

=

sValue

Case

"TransferDate"

'Insert formatting for search 'TransferDate' here...

MatchValue_Format

=

sValue

Case

"ZipCode"

'Insert formatting for search 'ZipCode' here...

MatchValue_Format

=

sValue

'** Insert cases for new searches here **

Case

Else

'This case catches any searches with formatting turned on but

'no case defined above.

MatchValue_Format

=

sValue

End Select

End Function

Figure 5-21. MatchValue_Format Function, Case “Date”

The date value is reformatted within the LibFreeForm_FormatDate function but the
return value (lRet) must also be checked for errors as shown above. Ensure lRet is
declared as a variable within the function.

X

To format the results from the transfer date search

1

Copy the formatting script code used for the “Date” field into the transfer
date case block.

You will need to remove the “on” or “at” from the start of the match.

2

Add the line below at the top of the block, which replaces the value with
itself, but only from the third character onwards:

sValue =

Mid

(sValue,3)

Extra spaces will be removed within the FormatDate function.

Note

Removing spaces by formatting could also be done during the search stage by

setting the Ignore Spaces property to True.

The account number and zip code do not need formatting.

Advertising