Reclassify documents via script

You can change the classification result of a document in script by calling the Reclassify method. This immediately stops the extraction for the current class and then executes extraction for the new class.

You can also use this for unclassified documents that require classification from the Project Class, using extraction results like a bar code or form ID, to a specific class. This is possible because the Project Class script events are executed before the classification events.

By default, the project-level fields and locators are not extracted again during subsequent extractions. Once extraction is performed, the Preserve flag for these fields and locators is set to TRUE and saved in the document. If one of the fields or locators requires extraction again in its newly classified class, you should set the Preserve flag to FALSE at the beginning of extraction. For example, in the BeforeExtract event.

Even though the Reclassify method can be executed multiple times for a document, you can call it only once per class that is executing the extraction. This is because extraction stops for a class when the Reclassify method is called.

For example, a document is classified to a child class. You can reclassify it to the parent class, and as soon as the extraction runs for the parent class, you can reclassify the document to yet another class.

The following extraction-related events are supported by the Reclassify method.

  • Document_BeforeExtract

  • Document_AfterExtract

  • Document_AfterProcessXDoc

  • Document_Validated*

  • <FieldName>_BeforeExtractField

  • <FieldName>_AfterExtractField

  • <FieldName>_AfterFieldReread

  • <FieldName>_AfterCellReread

* This event is also executed during validation.

When the Reclassify method is called for a document, the field results are cleared and re-initialized for the new class. If you want to keep the field results from the first extraction run, you can set the Preserve property of a field to TRUE. If the field is available in the new class, the field results are kept and the extraction is skipped for this field in the new class. Only formatting and validation are applied, if configured.

Fields, locators and project-level validation rules are available in all classes as inherited items.

Important For the Thin Clients, when the DocumentLoaded event executes the Reclassify method, it is limited to 10 executions when run in sequence.