Order of rule execution
Rules are run according to the position of the ruleset within the task profile, and the position of the associated object within the document hierarchy.
Two conditions determine whether a rule is run. A rule runs only when it is associated with a specific object in the document hierarchy. Also, the rule runs only when the parent ruleset is included in the current task profile.
The position of a rule within its ruleset does not affect when the rule is run.
When you run a task profile that has more than one ruleset, Datacap runs the rulesets in the order that the Task Profiles pane displays them in Datacap Studio. For example, the PageID task profile, Datacap first runs the ImageFix ruleset, and next runs the PageID ruleset.

Rental_Agreement, Datacap runs the Recognize
Page rule. - Car_Rental
- Open
- Rental_Agreement
- Open
- (global)
- CreateDocs:Create fields
- Recognize:Recognize Page
- (global)
The following example shows a portion of the document hierarchy
for the TravelDocs application. Each object also has a Close element. Datacap runs rules in the
object's Close element when it exits from the object. For
objects at the lowest level of the hierarchy, Close rules
run immediately after Open rules. For other objects,
the Close rules do not run until Datacap processes the lower-level objects.
- Open
- (global)
- VScan: VScan
- ImageFix: ImageFix Load Settings
- PageID: Set Fingerprint Params
- CreateDocs: Create Docs
- Document Integrity: Batch Document
- Export: Set Export Params
- (global)
- Other (Page)
- Open
- (global)
- ImageFix: Enhance Image
- PageID: PageID
- FingerprintAdd: FingerprintAdd
- (global)
- Close
- Open
- Car_Rental (Document)
- Open
- Rental Agreement (Page)
- Open
- (global)
- CreateDocs: Create Fields
- Recognize: Recognize Fields
- Validate: Validate Page
- Routing: Routing Rule 1
- Export: Export Page Fields
- Vendor (Field)
- Pickup_Date (Field)
- Open
- Global
- Validate: Validate Date
- Global
- Close
- Open
- (global)
- Open
TravelDocs Batch rules run when batch processing
begins, depending on the ruleset that you are running. For example,
if you are running the VScan ruleset, Datacap runs the VScan rule.Other page rules run each time Datacap begins processing
a page of type Other, which is the default page type
that is initially assigned to all pages. For example, if you are running
the PageID ruleset, Datacap runs
the PageID rule, which assigns the correct type to each page.
For the Car_Rental document, there are no document-level
rules in this example.
The Rental_Agreement page rules run each time Datacap begins processing
a page of type Rental_Agreement. For example, if
you are running the CreateDocs ruleset, Datacap starts the Create Fields rule,
which creates a page data file. Datacap uses the page data
file to store the data that is captured later by the Recognize ruleset.
The Pickup_Date field rule runs when Datacap is processing a page
of type Rental_Agreement and encounters a field of
type Pickup_Date.