Skip to main content
Kofax

How to save values from Classification or Extraction, other than document fields, for later use in a process.

Article # 3036100 - Page views: 25

Issue

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

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”.

Level of Complexity 

Moderate

 

Applies to  

Product Version Build Environment Hardware
Kofax TotalAgility All      

References

Add any references to other internal or external articles