comparing two fields in validation

comparing two fields in validation

Postby shannonmarie11 » Mon Sep 12, 2016 10:21 am

Hi everyone! I have 2 fields, one is the pagecount that is populated using code, and another is read via a barcode (expectedpagecount). How would I compare the value of expectedpagecount against pagecount and then skip over both if they are the same? Is this doable in the validation module or do I need something else?
Posts: 149
Joined: Fri Aug 01, 2008 10:50 am
Location: Seattle, WA

Re: comparing two fields in validation

Postby bclaman » Tue Sep 13, 2016 6:36 am

you can do what you need in the validation script. create a new validation script for your document class within that batch. Scroll down the code to the "Function KfxDocPreProcess ( Id As Long, NumberOfPages As Integer, _
AlreadyProcessed As Integer) As Integer" section

Within that function look for something like this:
On Error GoTo Failure

Insert your logic after that. Don't forget the value may be off by one depending on if you have a separator. it should probably be something similar to:
Code: Select all
If (NumberOfPages = KfxPageCountFromBarcode) Then
              KfxDocPreProcess = SaveAndSkipDocument
              Exit Function
          End If

You will also have to move the field variable definitions to the top of the script (above the doc pre process). They will look like: Global KfxPageCountFromBarcode as string
Posts: 258
Joined: Thu Sep 24, 2009 10:00 am
Location: Des Moines, IA

Re: comparing two fields in validation

Postby » Tue Sep 13, 2016 12:28 pm

IIRC, you need to use KfxAcmDocument.pagecount to retrieve the actual number of pages. The built-in page count is inaccurate (or at least was in some version of Capture).
Posts: 3374
Joined: Wed May 17, 2006 12:53 pm
Location: USA

Return to Kofax Capture General Discussion

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 6 guests