Document assembly script
What it does
This script is used to determine whether the array of documents passed to the user can be merged into one document.
For this, assembly errors for the result document are generated. The condition of a successful assembly is as follows: two documents will be merged into one, if the result document contains no more assembly errors than any of the source documents.
The script is configured on the Assembly tab of the Document Definition properties. To open the script editor window, click the Edit Assembly Script... button under the Use custom assembly rules option.
This script is executed either automatically after recognition or it can be run manually to refresh the assembly (for this, select Tools → Refresh Assembly command). In the first case the script will contain a number of assembly errors generated during the standard check.
|AssemblingErrors||IAssemblingErrors||Read/write||Resultant assembly errors|
|BatchItems||IBatchItems||Read-only||A collection of child elements (i.e. documents and pages) of a document|
Note: Document assembly scripts created in ABBYY FlexiCapture 11 and earlier will remain operational in ABBYY FlexiCapture 12. However, if you choose to delete such a script, you will have to write a script with the new interface that will use a collection of child elements.
Note: For better optimization of the assembly process, it is recommended to avoid addressing documents internal fields. When addressing documents internal fields, the whole document is loaded which can cause a slowdown of the assembly process. If you need to address the document fields, it is preferable to use index fields when possible.
Note: The AssemblingErrors parameter of the script can contain different assembly errors depending on the way of getting this parameter:
- AssemblingErrors can be passed to the script as one of input parameters. In this case it will contain the error of the current check.
- One of input parameters of the script is a collection of documents for which the assembly script is launched. Each document has its own assembly errors, which can be retrieved the following way: document.AssemblingErrors. In this case the AssemblingErrors parameter will contain errors of the last check carried out for the given document.
Procedures that you wish to use in more than one rule should be written to the global rule module, which can be accessed from the script editor. From the drop-down list on the toolbar of the script editor, select Rule Global Script Module. The global rule module can also be accessed from the Document Definition editor (Document Definition → Script Modules → Rule Script...).
If classes and methods of an external assembly are used in the script or global module, the assembly file must be attached on the .Net References tab of the Document Definition properties.