*** Archive *** Batch XValues
Question / Problem:
Batch XValues
Answer / Solution:
Use Case
You may want to access Kofax Capture Batch values, such as Batch creation site name, and perform some Batch routing, for example.
This KTM WIKI article describes what Kofax Capture Batch values are available and how to access them in KTM script.
Available Batch values:
Components
Script Locator
Option Explicit
' Class script: Base
Private Sub Script_LocateAlternatives(ByVal pXDoc As CASCADELib.CscXDocument, ByVal pLocator As CASCADELib.CscXDocField)
'## XValues
'## Script locator alternative
pLocator.Alternatives.Create
pLocator.Alternatives(0).Confidence = 1'## Alternative subfields
'## Batch information ## For more information see the 'Help for Kofax Transformation - Scripting -- Applying Scripting - Accessing Kofax Capture Data'
pLocator.Alternatives(0).SubFields.Create("AC_BatchName") 'Read only
pLocator.Alternatives(0).SubFields.Create("AC_BatchClassName") 'Read only
pLocator.Alternatives(0).SubFields.Create("AC_BatchPriority") 'Read/Write
pLocator.Alternatives(0).SubFields.Create("AC_BatchDirectory") 'Read only Documentation uses the variable name: AC_BATCH_DIRECTORY and the software uses the name: AC_IMAGE_DIRECTORY
pLocator.Alternatives(0).SubFields.Create("AC_BatchExtarnalBatchID") 'Read only Documentation uses the variable name: AC_BATCH_EXTERNAL_BATCHID and the software uses the name: AC_EXTERNAL_BATCHID
pLocator.Alternatives(0).SubFields.Create("AC_BatchGUID") 'Read only
pLocator.Alternatives(0).SubFields.Create("AC_BatchCreationDateTime") 'Read only
pLocator.Alternatives(0).SubFields.Create("AC_BatchCreationSiteName") 'Read only
pLocator.Alternatives(0).SubFields.Create("AC_BatchCreationUserID") 'Read only
pLocator.Alternatives(0).SubFields.Create("AC_BatchOperationUserID") 'Read only (user ID of last batch history entry)
pLocator.Alternatives(0).SubFields.Create("AC_BatchUserID") 'Read only
pLocator.Alternatives(0).SubFields.Create("AC_BatchUserName") 'Read only
pLocator.Alternatives(0).SubFields.Create("AC_BatchWindowsUserName") 'Read only'# Batch information is stored in the XRootFolder, i.e. the KTM batch information file
Dim pXRootFolder As CscXFolder
Set pXRootFolder = GetRootFolder(pXDoc.ParentFolder)BatchInfo(pXRootFolder, "AC_BATCH_NAME", pLocator, "AC_BatchName")
BatchInfo(pXRootFolder, "AC_BATCH_CLASS_NAME", pLocator, "AC_BatchClassName")
BatchInfo(pXRootFolder, "AC_BATCH_PRIORITY", pLocator, "AC_BatchPriority")
BatchInfo(pXRootFolder, "AC_IMAGE_DIRECTORY", pLocator, "AC_BatchDirectory")
BatchInfo(pXRootFolder, "AC_EXTERNAL_BATCHID", pLocator, "AC_BatchExtarnalBatchID")
BatchInfo(pXRootFolder, "AC_BATCH_GUID", pLocator, "AC_BatchGUID")
BatchInfo(pXRootFolder, "AC_BATCH_CREATIONDATETIME", pLocator, "AC_BatchCreationDateTime")
BatchInfo(pXRootFolder, "AC_BATCH_CREATIONSITENAME", pLocator, "AC_BatchCreationSiteName")
BatchInfo(pXRootFolder, "AC_BATCH_CREATIONUSERID", pLocator, "AC_BatchCreationUserID")
BatchInfo(pXRootFolder, "AC_BATCH_OPERATORUSERID", pLocator, "AC_BatchOperationUserID")
BatchInfo(pXRootFolder, "AC_BATCH_USERID", pLocator, "AC_BatchUserID")
BatchInfo(pXRootFolder, "AC_BATCH_USERNAME", pLocator, "AC_BatchUserName")
BatchInfo(pXRootFolder, "AC_BATCH_WINDOWSUSERNAME", pLocator, "AC_BatchWindowsUserName")End Sub
Private Function BatchInfo(ByVal RootFolder As CscXFolder, ByVal sBatchInfo As String, ByVal Locator As CscXDocField, ByVal sSubFieldName As String) As CscXDocSubField
Set BatchInfo = Locator.Alternatives(0).SubFields.ItemByName(sSubFieldName)If RootFolder.XValues.ItemExists(sBatchInfo) = True Then
BatchInfo.Text = RootFolder.XValues.ItemByName(sBatchInfo).Value
BatchInfo.ExtractionConfident = True
BatchInfo.Confidence = 1
End IfEnd Function
Public Function GetRootFolder(pXFolder As CASCADELib.CscXFolder) As CASCADELib.CscXFolder
If pXFolder.IsRootFolder Then
Set GetRootFolder = pXFolder
Else
Set GetRootFolder = GetRootFolder(pXFolder.ParentFolder)
End If
End Function
Note that this example was created on a workstation environment and not a client/server environment, therefore the user IDs and names are all the same.
Note also that the following variable names differ from the documentation and the script:
Download
Click this link to download the zipped example project: XValues - Batch Data (Created with V5.5)
Applies to:
Product | Version | Category |
---|---|---|
AXPRO | 5.5 | Project Builder |