XValue

The XValues (CscXValues) collection of an XFolder or an XDocInfo or an XDocument object is a collection that supports key and value pairs. You can access it by index or by key.

You can XValues to attach specific information to these objects. The XValues of the XDocInfo and XDocument objects are identical and synchronized. For the scripting user there is no difference between how these object are accessed.

The XValue (CscXValue) object is saved with the root XFolder object by setting the MustSave property to TRUE. Since the default value for the MustSave property is set to TRUE, so by default all created XValues are saved. If this property is set to FALSE the XValue exists as long as the root XFolder remains loaded. Note that during server processing the root XFolder is loaded and unloaded several times by different processes. This means that there may be delays accessing XValues during processing.

For accessing the XValues the following properties and methods are available:

Check if an XValue exists
If MyObject.XValues.ItemExists("XValue_Key") Then
...
End If
Access the value of an existing XValue
Dim sValue As String

sValue = MyObject.XValues.ItemByName("XValue_Key")
Review all XValue objects in the XValues collection
Dim oXValue As CascadeLib.CscXValue

For i As Integer = 0 To MyObject.XValues.Count - 1
     oXValue = MyObject.XValues.ItemByIndex(i)
     ...
Next
Sett the value of an XValue object

The Set method implicitly creates an XValue with the given key if it does not already exist and sets the given value. By default the MustSave property is set to TRUE.

MyObject.XValues.Set("XValue_Key", "XValue_Value")

' setting the new created or updated XValue 
' to .MustSave = False
Dim oXValue As CascadeLib.CscXValue
Set oXValue = MyObject.XValues.ItemByName("XValue_Key")

oXValue.MustSave = False
Get the XValue object by name to update its value. Set the MustSave property to FALSE so that the XValue is destroyed when the root XFolder is unloaded
Dim oXValue As CascadeLib.CscXValue

Set oXValue = MyObject.XValues.ItemByName("XValue_Key")

oXValue.Value = "New content for the value."

oXValue.MustSave = False
Add a new XValue object that is not saved with the root XFolder
MyObject.XValues.Add("NewXValue_Key", "NewXValue_Value", false)
Delete an XValue object
MyObject.XValues.Delete("XValue_Key")
Clear all XValue objects from the collection
MyObject.XValues.Clear()

In Kofax Capture Administration it is necessary to select the Kofax Transformation Toolkit batch class and then update its synchronization settings. To do this, right-click on the batch class and then select Extended Synchronization Settings. When the window is displayed, select Populate all index fields for read-only access in script. For more information, refer to this knowledge base article.