XValue

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

XValues can be used 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 from which object they are accessed.

The XValue (CscXValue) object is saved with the root XFolder object by setting the property MustSave to TRUE (default is TRUE), so by default all created XValues are saved. If setting it to 'false' the XValue exists as long as the root XFolder remains loaded. Take into consideration for the accessibility of XValues during server processing that the root XFolder gets loaded and unloaded several times by different processes.

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

  • Checking if an XValue exists:

    If MyObject.XValues.ItemExists("XValue_Key") Then
    ...
    End If
  • Accessing the value of an existing XValue uses the following syntax (before doing so you can check for its existence):

    Dim sValue As String
    
    sValue = MyObject.XValues.ItemByName("XValue_Key")
  • Iterating over 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
  • Setting the value of an XValue object. The Set method implicitly creates an XValue with the given key if it does not 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
  • Getting the XValue object by name to update its value and setting the MustSave property to False so the XValue gets 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
  • Adding a new XValue object that is not saved with the root XFolder:

    MyObject.XValues.Add("NewXValue_Key", "NewXValue_Value", false)
  • Deleting an XValue object:

    MyObject.XValues.Delete("XValue_Key")
  • Clearing all XValue objects from the collection:

    MyObject.XValues.Clear()

In Kofax Capture Administration it is necessary to select the Kofax Transformation Modules 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 appears, select Poplulate all index fields for read-only access in script. For more information, refer to this knowledge base article.