Cursors and filters – Kofax DOKuStar Validation User Manual

Page 67

Advertising
background image

DOKuStar Validation Programming Manual

Page

63

Cursors and Filters

These topics are covered together, because there are some dependencies between them.

Cursors control which fields and/or documents will get activated in the DOKuStar Validation’s user interface. They
do not denote the shape of the cursor.

Cursors are mainly defined by a set of filters. There are three types of filters defined in DOKuStar Validation: Field
state filters, field confidence filters and document type filters. These filters can either be set by the user, using the
combo boxes in the toolbars, or by script programming.

The cursor reflects the setting of these filters. If, for example, the Field state filter is set to “all”, the method

Cursor.NextField

will activate the field following the current one. If the Field state filter is set to “empty”,

Cursor.NextField

will activate the next empty field.

Currently, there is one cursor named

default

, which has three filters assigned, named

fieldstate,

fieldconfidence

and

documenttype

. To change the behavior of the cursor at the user interface (i.e. which

fields get activated), there are two ways:

-

take the default cursor, and change the behavior of the filters,

-

add a new cursor along with filters.

Each way will be shown in an example. The goal is to jump only to documents of type

Invoice

or

Order

,

and there only to fields that have the state

error

or

reject

:

Example 1:

Option Explicit

Private Sub Application_OnProjectLoaded(ByVal App As Application)
Dim crs As Cursor
Dim fieldFilter As FieldStateFilter
Dim docFilter As DocumentTypeFilter
Dim docType As DocumentType

'* take the current cursor which is the default
Set crs = App.Project.DataSet.Controller.Cursor
Set fieldFilter = crs.Filters("fieldstate") '* get the fieldState Filter
Set docFilter = crs.Filters("documenttype") '* get DocumentType Filter
fieldFilter.Reset '* set all states to FALSE
docFilter.Reset '* set all Doc.Types to FALSE
fieldFilter.State(StateReject) = True '* set StateReject to TRUE
fieldFilter.State(StateError) = True '* set StateError to TRUE

'* get the "Invoice" doc.type object
Set docType = App.Project.DataSet.Schema.DocumentTypes("Order")
docFilter.Type(docType) = True
End Sub

The code first gets the current

Cursor

object, which is the cursor named

default

. From this cursor, those two

predefined filter objects

fieldstate

and

documenttype

are fetched. These two objects are special

implementations of the common

Filter

object,

FieldStateFilter

and

DocumentTypeFilter

. Next, the two

filters are reset (if the code ended here, no field would ever get activated). Then you switch on which field states and
document types will get activated.

Advertising