/
Kofax-Parse One OCR Result into Multiple Fields

Kofax-Parse One OCR Result into Multiple Fields

Applies to

Kofax Capture 10.x and 11.0

Summary

How to use a Validation Script to parse one OCR result into multiple fields?

Answer/Solution

Below is an example of a Validation Script that parses one OCR field result into multiple Index Fields. This code needs to be placed in the script's KfxDocPreProcess function after the On Error GoTo statement.
Four variables have been created, whose names will have to be changed to match your own field names.

They are:

  • EnteredValue — This value holds the value that was OCR'ed as one zone with all names.

  • Kfx1 — Used for the First Name field.

  • Kfx2 — Used for the Middle Name field, if one existed.

  • Kfx3 — Used for the Last Name field.

Below are the assumptions the code makes:

  • If there are no spaces, place the whole value in the first name field, (Kfx1).

  • If there is 1 space, then there are 2 names place the value before the space in the first name field (Kfx1) and place the value after the space in the last name Field, (Kfx3).

  • If there are 2 spaces, then there are 3 names. Place each name in their respective fields: first (Kfx1), middle (Kfx2) and last name Field, (Kfx3).

  • If there are more that 3 spaces, there are more than 3 names. Set the document to error.

Remember to replace these variables with your field names, remembering that the Validation Script prepends Kfx to each field name.


 

**************************************************************************** Dim strTemp As String Dim nStartPos As Integer Dim nSpcPos as Integer Dim nSpcCnt as Integer Dim x As Integer Dim nStrLen As Integer EnteredValue = Trim(EnteredValue) If ( Len(EnteredValue) > MaxLength ) Then GoTo Failure nSpcPos = 1 nStrLen = Len(EnteredValue) nSpcPos = InStr(nSpcPos, EnteredValue, Chr(32)) Do While nSpcPos <> 0 If nSpcPos <= nStrLen Then nSpcCnt = nSpcCnt + 1 End If nSpcPos = InStr(nSpcPos +1, EnteredValue, Chr(32)) Loop If nSpcCnt > 2 Then GoTo Failure Select Case nSpcCnt Case 0 Kfx1 = EnteredValue Case 1 nSpcPos = 1 nStartPos = 1 nSpcPos = InStr(nStartPos, EnteredValue, Chr(32)) strTemp = Mid(EnteredValue, nStartPos, nSpcPos-1) Kfx1 = strTemp nStartPos = nSpcPos + 1 strTemp = Mid(EnteredValue, nStartPos, nStrLen - nSpcPos) Kfx3 = strTemp Case 2 nSpcPos = 1 nStartPos = 1 nSpcPos = InStr(nStartPos, EnteredValue, Chr(32)) For x = 1 to 2 strTemp = Mid(EnteredValue, nStartPos, nSpcPos - nStartPos) If x = 1 Then Kfx1 = strTemp ElseIf x = 2 Then Kfx2 = strTemp End If nStartPos = nSpcPos + 1 nSpcPos = InStr(nStartPos, EnteredValue, Chr(32)) Next x strTemp = Mid(EnteredValue, nStartPos, nSpcPos - nStartPos) Kfx3 = strTemp End Select

 

Related content

Kofax - Creating an Index Field Zone for Auto Indexing
Kofax - Creating an Index Field Zone for Auto Indexing
More like this
Kofax-Database Validation using an Excel spreadsheet
Kofax-Database Validation using an Excel spreadsheet
More like this
Kofax - Adding a New Field to an Existing Validation Script
Kofax - Adding a New Field to an Existing Validation Script
More like this
Kofax - Script Driven option in the Capture Database Validation settings
Kofax - Script Driven option in the Capture Database Validation settings
More like this
Kofax - Batch Field Validation
Kofax - Batch Field Validation
More like this
Kofax - Scripting - Validation - Save and Skip a Document in a Field PostProcessing Event
Kofax - Scripting - Validation - Save and Skip a Document in a Field PostProcessing Event
More like this

Copyright © CASO Document Management

All product names, logos, brands, and trademarks featured or referred to on this page are the property of their respective trademark holders. These trademark holders are not affiliated with, nor do they sponsor or endorse this website or the products/services offered unless explicitly stated otherwise.