Owner's manual

DOKuStar Validation for Ascent Capture Page 93
How Do I…
Reject Documents and Pages
Documents and pages can be rejected and un-rejected by the user: He clicks on the document/page in the tree view
and chooses
reject… or unreject from the context menu. Also, he can add a reject text to the object.
This can also be achieved by scripting.
To reject a document or page, add a
UserData named Rejected to the Document or DataSource object
and set its value to
1. If you additionally want to add a reject text, add a UserData named RejectText and set it
to the desired text.
DOKuStar Validation itself uses the same
UserData when the user rejects an object from the tree view. Thus, you
can determine in the script if the user rejected a document or page by checking a
UserData named Rejected
exists and if its value is set to
1.
In the following example, all documents which are of document type
Unknown will be rejected, and a text will be
added. Before adding the text, it is checked if the user himself rejected the document and added a text; if so, the
additional text is inserted in front of the existing one. This is all done when the user closes the batch.
Option Explicit
Dim WithEvents batch As Data
Private Sub Application_OnProjectLoaded(ByVal App As Application)
Set batch = App.Project.DataSet.Data
End Sub
Private Sub batch_OnPreExported(ByVal Data As Data, ByVal Mode As ExportMode)
Dim doc As Document
Dim userText As String ' text entered by the user
If Mode = ExportModeSuspend Then Exit Sub ' No action, if suspended
For Each doc In Data.Documents ' cycle through the documents
If doc.Name = "Unknown" Then
userText = ""
If doc.UserData.HasValue("Rejected") And doc.UserData.Value("Rejected") = "1" Then
' user already rejected it
If doc.UserData.HasValue("RejectText") Then
userText = ", " & doc.UserData.Value("RejectText") ' get the text and add a
comma in front of it
End If
End If
doc.UserData.Value("Rejected") = "1" ' Reject this document
doc.UserData.Value("RejectText") = "Validation operator did not change this unknown
form type" & userText
End If
Next doc
End Sub