Skip to main content
Kofax

Is it possible to save values from Classification or Extraction, other than document fields, for later use in a process?

Transformation script can save to XValues to store key value pairs to be used later in a process.
3011163

Question / Problem: 

Is it possible to save values from Classification or Extraction, other than document fields, for later use in a process?

Answer / Solution: 

Yes, string key value pairs can be saved as XValues in Transformation script.  Extraction Groups have document fields which can be used to persist any value, however for values that are not meant to be shown to the user in validation, it might be preferable not to use a document field.  Classification Groups do not contain fields, so to persist a value from Classification, it should be saved as an XValue. 

To save a value in the Transformation script of Classification or Extraction, set an XValue like this:

pXDoc.XValues.Set("ExampleName", "ExampleValue")
pXDoc.XValues.ItemByName("ExampleName").MustSave=True
pXDoc.XValues.ItemByName("ExampleName").MustSynchronize=True

If the value was saved in Classification and needed to be accessed in Extraction, the following Transformation script could be used to retrieve the value:

Dim Example As String
If pXDoc.XValues.ItemExists("ExampleName") Then
   Example=pXDoc.XValues.Item("ExampleName")
End If

If the value is to be accessed later in the process, the CaptureDocumentService.GetTextExtension API can be used in either a custom .NET assembly, directly in a .NET activity, or in a Script activity.  When the XValue is saved it also creates a Text Extension with “XValue.” added to the start of the name.  So for in this example, the value would be retrieved by calling GetTextExtension with the name “XValue.ExampleName”.

 

Applies to:  

Product Version
KTA 7.0+

 

Author:  Stephen Klancher