Reputation: 669
I'm working on a Kofax KTM project, that have multiple Validation steps. After the KTM Server Module the batch will be routed to another validation step depending on the Batch name.
Now the routing works well, but if its not the first validation step the following error occurs:
Anyone an idea how to fix this? thx
Here is my code:
' Rout Document to the Correct Validation step.
Private Sub Batch_Close(ByVal pXRootFolder As CASCADELib.CscXFolder, ByVal CloseMode As
CASCADELib.CscBatchCloseMode)
Dim i As Long
Dim mandat As String
Dim lVal As Long
Dim strVal As String
Dim oXDocInfo As CASCADELib.CscXDocInfo
Dim folder As CASCADELib.CscXFolder
' only enter after extraction and after validation
If CloseMode = CASCADELib.CscBatchCloseFinal Then
If Project.ScriptExecutionMode = CscScriptModeServer Or Project.ScriptExecutionMode = CscScriptModeValidation Then
' get root folder
Set folder = pXRootFolder
While Not folder.IsRootFolder
Set folder = folder.ParentFolder
Wend
' get batch name
mandat = folder.XValues.ItemByName("AC_BATCH_CLASS_NAME").Value
lVal = 0
strVal = ""
Select Case mandat
Case "x"
lVal = 0
Case "y"
lVal = 2
End Select
strVal = CStr(lVal)
If Project.ScriptExecutionMode = CscScriptModeValidation Then
For i = 0 To folder.GetTotalDocumentCount - 1
Set oXDocInfo = folder.GetDocInfoByGlobalIndex(i)
oXDocInfo.XValues.Set("KTM_DOCUMENTROUTING", strVal)
Next
folder.XValues.Set("KTM_DOCUMENTROUTING_QUEUE_" & strVal, "kfxpdf.exe")
ElseIf Project.ScriptExecutionMode = CscScriptModeServer Then
For i = 0 To folder.GetTotalDocumentCount - 1
Set oXDocInfo = folder.GetDocInfoByGlobalIndex(i)
oXDocInfo.XValues.Set("KTM_DOCUMENTROUTING", strVal)
oXDocInfo.XDocument.NextValidationInstance = lVal
Next
' validation is not done => rout to the depending validation instance
If(lVal = 0) Then
folder.XValues.Set("KTM_DOCUMENTROUTING_QUEUE_" & strVal, "KTM.Validation")
Else
folder.XValues.Set("KTM_DCOUMENTROUTING_QUEUE_" & strVal, "KTM.Validation")
folder.XValues.Set("KTM_DOCUMENTROUTING_QUEUE_" & strVal, "KTM.Validation" & strVal)
pXRootFolder.Valid = False
End If
End If
End If
End If
End Sub
Upvotes: 3
Views: 705
Reputation: 669
I found the problem:
The value of KTM_DOCUMENTROUTING_QUEUE_
must not be the same like the next validation instance...
so thats the code that works:
Private Sub Batch_Close(ByVal pXRootFolder As CASCADELib.CscXFolder, ByVal CloseMode As CASCADELib.CscBatchCloseMode)
Dim i As Long
Dim mandat As String
Dim lVal As Long
Dim strVal As String
Dim oXDocInfo As CASCADELib.CscXDocInfo
Dim folder As CASCADELib.CscXFolder
' only enter after extraction and after validation
If CloseMode = CASCADELib.CscBatchCloseFinal Then
If Project.ScriptExecutionMode = CscScriptModeServer Or Project.ScriptExecutionMode = CscScriptModeValidation Then
' get root folder
Set folder = pXRootFolder
While Not folder.IsRootFolder
Set folder = folder.ParentFolder
Wend
' get batch name
mandat = folder.XValues.ItemByName("AC_BATCH_CLASS_NAME").Value
lVal = 0
strVal = ""
Select Case mandat
Case "x"
lVal = 0
Case "y"
lVal = 1
End Select
strVal = CStr(lVal)
folder.XValues.Set("KTM_DOCUMENTROUTING_QUEUE_" & strVal, "kfxpdf.exe")
ElseIf Project.ScriptExecutionMode = CscScriptModeServer Then
For i = 0 To folder.GetTotalDocumentCount - 1
Set oXDocInfo = folder.GetDocInfoByGlobalIndex(i)
oXDocInfo.XValues.Set("KTM_DOCUMENTROUTING", strVal)
oXDocInfo.XDocument.NextValidationInstance = lVal
oXDocInfo.XDocument.Valid = False
Next
' validation is not done => rout to the depending validation instance
If(lVal = 0) Then
folder.XValues.Set("KTM_DOCUMENTROUTING_QUEUE_" & strVal, "KTM.Validation")
Else
folder.XValues.Set("KTM_DCOUMENTROUTING_QUEUE_" & strVal, "KTM.Validation")
folder.XValues.Set("KTM_DOCUMENTROUTING_QUEUE_" & strVal, "KTM.Validation" & CStr(lVal + 1))
pXRootFolder.Valid = False
End If
End If
End If
End If
End Sub
Upvotes: 0
Reputation: 2349
This isn't an error per se but rather an informative message, telling you that the batch has no error, and that you might as well close the batch in Validation right away. Not having seen the project, this might be a stretch - but it would explain why you would see said message in the first instance of Validation. This is based on the assumption that you have no validation rules in your project, no fields set to require manual confirmation, thus all documents are valid at any time.
When opening a batch in Validation 1, none of your documents will have an error - consequentially, KTM makes the entire xfolder object valid. However, there is this single line in your code: pXRootFolder.Valid = False
- meaning that you manually set the root folder invalid for all other instances of Validation.
To verify my hypothesis, simply set one of the fields to "manual confirmation required", or the valid property of your root folder to false - this should then result in Validation 1 showing a similar behavior to all other instances. In addition, when opening batches in Validation, take a close look at the folder (or batch if there is only one folder) symbol in the tree at the left-hand side of your screen - there should be a difference between Validation 1 and 2.
If you want to be absolutely sure, process two batch right before validation 1 and 2, but don't open them yet. Navigate to your server file share, typically \\{Server}\CaptureSV\Images
, and copy the two most recent folders to any location. Open those folders in Project Builder (make sure to select the folder that holds your xfd file, or the folder object), and observe that one batch is valid while the other isn't (for example by testing validation in Project Builder, or F8).
Upvotes: 2