(AlreadyProcessed) not processing

(AlreadyProcessed) not processing

Postby twildt » Wed Jan 20, 2016 1:02 pm

I have the following code setup on a field, I can't figure out why its not processing through the (AlreadyProcessed) section... My integer check statement keeps coming back with a value of "0" instead of "1".

Code: Select all

Function KfxDocPreProcess ( Id As Long, NumberOfPages As Integer, _
             AlreadyProcessed As Integer) As Integer
   On Error GoTo Failure

   If (AlreadyProcessed) Then
      KfxDocPreProcess = NoError
     
      FIELD_PROCESSED = 1
     
      Exit Function
   End If

################################################################################
                     '----- Matter default value: ""
                     '-----------------------------------------------
Function PreMatter() As Integer
   On Error GoTo Failure
   If FIELD_PROCESSED = 1 Then GoTo Validate
   If ( Val(KfxCLMatter) < 100 ) Then
    msgbox "Processing barcode unsuccessful"   
    GoTo Validate
   ElseIf Trim$(KfxMatter) = "" Then
    GoTo Validate
   Else
    PreMatter = SaveAndSkipField
   End If   
   Exit Function
Validate:
   PreMatter = NoError
   Exit Function
Failure:
   PreMatter = FatalError
   Exit Function
End Function
                     '----- Matter validation: checks
                     '----- to see if max length exceeded
                     '-----------------------------------------------

Function PostMatter( EnteredValue As String, MaxLength As Integer ) As Integer
   On Error GoTo Failure
     
   EnteredValue = Trim(EnteredValue)
   If ( Len(EnteredValue) < 2 OR  Len(EnteredValue) > 30) Then GoTo Failure
   
   KfxMatter = EnteredValue
   PostMatter = NoError
   Exit Function
Failure:
   PostMatter = ValidationError
   Exit Function
End Function
twildt
Participant
 
Posts: 108
Joined: Tue Dec 17, 2013 2:09 pm

Re: (AlreadyProcessed) not processing

Postby russell@centuryc.com » Wed Jan 20, 2016 3:40 pm

When are you expecting it to go there? I think the only time that happens is if the operator manually goes to that document in Validation. Under normal circumstances, Kofax won't return to a already processed document automatically.

I'd also make sure you have some code to set FIELD_PROCESSED back to zero for a document that hasn't already been processed. Otherwise, once you do pass though that section, it will stay "stuck" on 1 for all documents until you reopen the batch.

I assume you're defining FIELD_PROCESSED in such as way that it's global to all sections, right?
Russell
russell@centuryc.com
Participant
 
Posts: 3374
Joined: Wed May 17, 2006 12:53 pm
Location: USA

Re: (AlreadyProcessed) not processing

Postby twildt » Thu Jan 21, 2016 6:47 am

Oh... I see your point. So when I have 1 page only and 1 document only in the batch, and i'm on the last field in validation, I click out of it to the first field, that doesn't cause the PreDoc to run again does it... I just assumed it ran through the whole process again.

Ok, so I guess I need to set my own flag maybe in the post event of each of my individual fields then so that it will allow them to be able to stay on a document, and click back and forth between the fields, all while I have saveandskipfield set for the initial run through if all parameters are met??

And what is a good method/catch to check for to set the FIELD_PROCESSED back to zero again? I thought that this setting was reset automatically for multiple documents in a batch... So I run through one document validation fields, it moves on to the next document in same batch and that value is zero for the next document. Is that wrong?

I'm learning here, thanks for all your input!!
twildt
Participant
 
Posts: 108
Joined: Tue Dec 17, 2013 2:09 pm

Re: (AlreadyProcessed) not processing

Postby russell@centuryc.com » Thu Jan 21, 2016 7:51 pm

twildt wrote:Ok, so I guess I need to set my own flag maybe in the post event of each of my individual fields then so that it will allow them to be able to stay on a document, and click back and forth between the fields, all while I have saveandskipfield set for the initial run through if all parameters are met??

Sounds like a plan.


twildt wrote:And what is a good method/catch to check for to set the FIELD_PROCESSED back to zero again? I thought that this setting was reset automatically for multiple documents in a batch... So I run through one document validation fields, it moves on to the next document in same batch and that value is zero for the next document. Is that wrong?

If the field belonged to the document, then the field would would take on the value that the document had. But it's not a document field. It's your own variable defined globally. It won't go back to zero until you exit Validation.

Try this:
Code: Select all
   If (AlreadyProcessed) Then
      KfxDocPreProcess = NoError
     
      FIELD_PROCESSED = 1
     
      Exit Function
   Else
      FIELD_PROCESSED = 0
   End If


Now every time you start a document, you're setting the value of FIELD_PROCESSED instead of relying on it to initialize.
Russell
russell@centuryc.com
Participant
 
Posts: 3374
Joined: Wed May 17, 2006 12:53 pm
Location: USA

Re: (AlreadyProcessed) not processing

Postby Hando Penu » Tue Jun 07, 2016 11:34 pm

Hi!

I had just a case when suddenly DocPreProcess event stopped working. I have some documents classified to another doc class and they do nit need any manual intervention, all code to fill some fieldsare in DocPreProcess with SaveAndSkipDocument. Only thing that seemed to be working was SaveAndSkipDocument..
In test it worked perfectly, in live, the DocPreProcess is never launched... Tried both, .NET and SBL script....
KC is 10 SP2 FP6
Hando Penu
Participant
 
Posts: 362
Joined: Thu Jul 17, 2008 9:42 pm

Re: (AlreadyProcessed) not processing

Postby russell@centuryc.com » Wed Jun 08, 2016 12:08 pm

Hando Penu wrote:I had just a case when suddenly DocPreProcess event stopped working.


What changed? Was a patch applied?

My most common problem I have is forgetting to delete/comment out the line from the template that sets the result to "NoError". Here I'm staring at all of my added code and forgetting about what happens just before it exits. :roll:
Russell
russell@centuryc.com
Participant
 
Posts: 3374
Joined: Wed May 17, 2006 12:53 pm
Location: USA

Re: (AlreadyProcessed) not processing

Postby Hando Penu » Thu Jun 09, 2016 10:01 pm

Hi!

What happened - moved to live. Test environment was extremly simplified batch class with two doc classes. one had .net validation script attached, second one did not have. I have an importer that put's documents into different doc class based on predefined criterias (digitally signed files, doc class depends on number of signatures, doc's with one signature only is considered as "fault" and go to one doc class, all others to second one).

So I had a PreDoc script that did set some variables and did read some Kofax field values to set them and finally to close the doc with saveandskipdoc as all it's fields are automatically filled in script.
As long I was in development , everything worked fine. I have all in one KC system , so no differences between dev and production.
Then I moved to live. There I had 3 doc classes, one of them for "Fault" docs. All other doc classes now had a SBL scripts defined. And the "fault" doc scripts did not fire any more. First I suspected that SBL + .NET is the culprit, but no, moved the doc class to SBL script - all is the same..

Now I have the code in PreField events and it works.

I triple checked the return values, all were correct...

Now I'm waiting for SP1 release for 10.2 (with Win10 support) to upgrade installation to it. Currently 10.0 SP2
Hando Penu
Participant
 
Posts: 362
Joined: Thu Jul 17, 2008 9:42 pm


Return to Kofax Capture General Discussion

Who is online

Users browsing this forum: No registered users and 8 guests

cron