Skip to main content
Kofax

Batch Restructuring

17789

QAID # 17789 Published

Question / Problem:

Batch Restructuring

Answer / Solution:

IMPORTANT: The Batch Restructuring capability was introduced in KTM 5.0 and requires Kofax Capture 9.0 or higher.

Use Case

  • Alter the Document Class (Document Review)
    This can be done in the Document Review – Batch Close, or in Server 2 – Batch Open, if the process is time consuming.
  • Moving Documents (Document Review)
    After the user validates the Classification results, certain Documents can be moved to the end of the Batch in the BatchClose event.
  • Sorting Documents
    Example: Grouping Documents logically in a Batch together, which will make the work for the validation user easier.
  • Tracking User Changes (Document Review)
    KTM Document Review currently records statistics for user operations such as merging, splitting and moving Documents. The statistics are used in PS Advanced Reports to track user activity.

Technical Info

Batch Restructuring is possible in the following KTM modules:

  • KTM Server
  • KTM Document Review
  • KTM Validation and Verification

Batch Restructuring is possible in the following script events:

  • Batch Open (Project class script)
    Private Sub Batch_Open(ByVal pXRootFolder As CASCADELib.CscXFolder)
        '## Your batch restructuring code here
    End Sub
  • Batch Close (Project class script)
    Private Sub Batch_Close(ByVal pXRootFolder As CASCADELib.CscXFolder, _
                            ByVal CloseMode As CASCADELib.CscBatchCloseMode)
        '## Your batch restructuring code here
    End Sub
  • Foldering (Root folder script)
    Private Sub RootFolder_DoFoldering(ByVal pXRootFolder As CASCADELib.CscXFolder)
       '## Your batch restructuring code here
    End Sub

The following Batch Restructuring functions are available in script:

Screen Shot 2018-09-12 at 3.56.26 PM.png
Figure 1

ScriptExecutionMode, ScriptExecutionInstance and CloseMode need to be considered when performing Batch Restructuring (See Figure 2).

  • There are eight script execution modes.
  • The server may be instance 1 or 2, and the Validation module may have several instances depending on the Batch Class definition.
  • The Batch Close Mode has three different states.

Screen Shot 2018-09-12 at 3.57.55 PM.png
Figure 2

"Validation On Demand"

After the Batch has been restructured it will be validated, i.e., the Batch and the Documents in the Batch will be validated.

If the restructured Batch should not be validated, then the validation can be temporarily switched off:

Project.ValidateAfterBatchRestructuring = False

This is reset to True after the event execution is complete.

In the Download section of this article there are two example projects that demonstrate the use of KTM Batch Restructuring capabilities

Solution

Example project 2

The Batch to be processed:

Screen Shot 2018-09-12 at 3.59.37 PM.png

The Batch after Extraction (what it would look like once the server has completed its work):

Screen Shot 2018-09-12 at 4.00.12 PM.png

After Batch Restructuring:

Screen Shot 2018-09-12 at 4.00.36 PM.png

This is the script that performs this particular Batch Restructuring:

Option Explicit
' Project Script
Private Sub Batch_Close(ByVal pXRootFolder As CASCADELib.CscXFolder, _
                        ByVal CloseMode As CASCADELib.CscBatchCloseMode)
   '## Server 1 after processing all documents sort the document according to the class result
   '## The method applied here is the classic Bubble-Sort algorithm.
   '    Suitable for up to 200 classes
   If Project.ScriptExecutionMode = CscScriptModeServer And _
     Project.ScriptExecutionInstance = 1 And CloseMode = CscBatchCloseFinal Then
      Dim bUnsorted As Boolean
      bUnsorted = True
      Do While bUnsorted
         Dim i As Integer
         bUnsorted = False
         For i = 0 To pXRootFolder.DocInfos.Count - 2
            If StrComp(pXRootFolder.DocInfos(i).ExtractionClass, _
              pXRootFolder.DocInfos(i + 1).ExtractionClass) = 1 Then
               Batch.MoveDocument(pXRootFolder, i, i + 1)
               bUnsorted = True
            End If
         Next
      Loop
   End If
End Sub

Download 

Applies To: 

Product Version Category
AXPRO 5.5 Script
  • Was this article helpful?