Userdata – Kofax DOKuStar Validation User Manual

Page 51

Advertising
background image

DOKuStar Validation for Ascent Capture

Page

47

UserData

UserData

is an object that is linked to each field and document object. It serves as a container for additional data

that you want to attach to the field or document. This data are organized as key/value pairs. You can attach as many
of these key/value pairs to the document as you like.

Example:

Whenever the user changes the contents of a field, the original value shall be saved. When the field is activated again
later on, the old contents shall be displayed in the status window.

Option Explicit

Dim WithEvents ctrl As Controller
Dim status As New StatusTextTransporter

Private Sub Application_OnProjectLoaded(ByVal App As Application)
Set ctrl = App.Project.DataSet.Controller
End Sub

Private Sub ctrl_OnFieldActivated(ByVal Controller As Controller, ByVal Field As Field, _
ByVal PreviousField As Field)
If Field.UserData.HasValue("OldValue") Then
status.Text = "Original Value: " & Field.UserData.Value("OldValue")
Else
status.Reset
End If
End Sub

Private Function ctrl_OnFieldChanging(ByVal Controller As Controller, ByVal Field As Field, _
ByVal SubField As Field, _
ByVal VerifyEventArgs As VerifyEventArgs) As Boolean
'* Don't override an existing OldValue
If Not Field.UserData.HasValue("OldValue") Then
'* Store the old value which is contained in the VerifyEventArgs
Field.UserData.Value("OldValue") = VerifyEventArgs.PreviousValue
End If

ctrl_OnFieldChanging = True
End Function

Properties and methods of the

UserData

object (excerpt):

Property/Method

Returns

Description

HasValue

Boolean

Checks if there is a value for a specific key
Parameters:

key as String

Value

String

Sets/Gets a value associated with a key
Parameters:

key as String

RemoveValue

--

Removes a key/value pair
Parameters:

key as String

Advertising