Skip to main content
Kofax

Compare entered value by Validation Operator instead of the previous value using a .NET Validation Script

13924

QAID # 13924 Published

Question / Problem:

In a .NET Index (Validation) Script, how can I easily compare the value entered into the Index Field by the Validation operator versus the Index Field’s previous value?

Answer / Solution:

The PreviousValue property will display the value of the Index Field before any updates made to it by the operator. It is available during the Index Field’s Post Processing event. The value of this property can be used in conjunction with the Index Fields’ Value property to compare the two.

The Value property of the Index Field will contain the value that was last entered into the Index Field. The PreviousValue property will list the value when the field was first originally entered.

The following example shows the field Post Processing event for the “Name” Index Field. In this example, the previous value of the Index Field is compared to the latest value. If no changes were made to the field, a Validation Error is thrown:

Private Sub Name_FieldPostProcessing(ByVal sender As Object, ByVal e As_
Kofax.AscentCapture.Scripting.PostFieldEventArgs)
Handles Name1.FieldPostProcessing
    If e.PreviousValue = Name.IndexField.Value Then
        Throw New ValidationErrorException("Name field value has not been updated!")
    End If
End Sub

Applies to:

Product Version
CAPTURE 10.0
  10.1
  10.2
  11.0