Changing the color of documents – Kofax DOKuStar Validation User Manual

Page 117

Advertising
background image

DOKuStar Validation Programming Manual

Page

113

Changing the Color of Documents

Sometimes it may be necessary to inform the validation operator, which documents are always processed or which
documents still contain errors after they have been processed by the operator. This can be done by changing the color
of the document in the

Tree View

, using the

ColorService

.

In the following example we use the

OnDocumentDeactivated

event as indicator that the validation operator

changed to another document. The function

CheckFieldStates

checks all fields of the last processed document if

they have the state empty. Depending on the result the corresponding document will be highlighted with an
appropriate color (green: the document contains no empty field, blue: the document contains one ore more empty
field) in the

colorDoc

subroutine:

Option Explicit

Dim WithEvents Ctrl As Controller

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

Private Sub Ctrl_OnDocumentDeactivated(ByVal Controller As Controller, _
ByVal Document As Document, _
ByVal NextDocument As Document)

CheckFieldStates Document, StateEmpty ' set target state to Empty
End Sub

Private Function CheckFieldStates(doc As Document, targetState As State) As Boolean

Dim fld As Field
Dim table As TableField
Dim row As TableRow
Dim cell As Field
Dim bnOK As Boolean

CheckFieldStates = True
bnOK = True

For Each fld In doc.Fields ' cycle through all documents
If fld.FieldDescriptor.FieldClass.Name = "TableField" Then ' in case of a table field...
Set table = fld
For Each row In table.Rows ' ...cycle through all cells
For Each cell In row
If cell.State = targetState Then
bnOK = False ' table cell is empty
Exit For
End If
Next cell
Next row
Else
If fld.State = targetState Then
bnOK = False ' field is empty
Exit For
End If
End If
Next fld

colorDoc doc, bnOK

End Function

Advertising