Scripting functionality in Ephesoft is supported where a custom requirement can be handled. Ephesoft includes power to perform custom functionality during different stages of batch processing. This functionality is supported through the scripts present inside batch class folder in Scripts folder. These scripts are Java scripts which access batch.xml through two techniques: DOM Parser and JDOM Parser. All the scripts present should be developed using one of the earlier mentioned parser only.

Batch Instance Group Feature

This feature is used to provide the roles on the batch instance. If user role have an access to batch instance using batch instance group feature than that batch will display on the BatchList screen. User will able to review/validate the same batch instance.

For this feature we are introduced the new database table “batch_instance_groups” for storing the batch instance identifier and user roles. This table stores all the mapped user roles with the batch instances.

Database Structure:

BatchInstanceGroupDb

Method for assigning roles in batch instance group table:

public void assignedBatchInstanceGroup(String batchInstanceIdentifier, String userRole) throws DCMAException

Configurable parameters:

BatchInstanceGroupParams

Example file: ScriptDocumentAssembler_BatchInstanceGroupFeature.java

Force Review Feature

The following is the implementation of the ForceReview feature:

  1. A new tag is added to the batch.xml for any document level field by the name ForceReview. Assumption: This “ForceReview“ tag will come into play only if the document containing it is invalid.
  2. This tag is not mandatory. If it does not exist(or the value of it is not “true”) for a document level field, the functionality will work as earlier.
  3. When this batch opens on the RV Screen, and this tag is found with a value “true” (for an invalid document):
    1. Before the user saves the document once(by pressing CTRL+s/S or CTRL+q/Q) this field will appear RED(irrespective of REGEX validation).
    2. Once the user presses CTRL+s/S or CTRL+q/Q on a certain field, we will make the value of the tag forceReview “False” for that field and the field will now get validated according to the earlier functionality (REGEX validation).

It is expected that it will be the responsibility of the script to handle the setting of the ForceReview tag in sync with the document validity setting.

The ForceReview tag of a field will not make a document invalid. It will only prevent a document level field from getting validated(in a document in an invalid state) if set to true.

This ForceReview tag won’t exist by default(before validation).

Provided is a sample script for the generation of this ForceReview tag(or modifying it if it is already present) with a value “true” for every alternate(note the i+=2 in the script) document level field encountered in a batch.xml.

Example file: Force_Review_Feature_SampleScript.java

ScriptAddNewTable.java

The Add New Table script is useful for being able to generate a predefined table on the fly in the Validation view.

Example Scenario:

If you are processing invoice documents and have defined table extraction during the normal means, it is still possible that if the document is of poor image quality the table you have defined for extraction may not be detected, or may be incomplete. In this case, you can use the Add New Table script to automatically generate a table for your invoice document type with the click of a button. You could create a new empty table of your required structure, or even a populated one… using other extracted values from the documents fields to populate the table values from a database table.

Example file: ScriptAddNewTable.java

ScriptAutomaticValidation.java

The Automatic Validation script is executed in the Ephesoft Batch Class work flow prior to reaching the Validation stage. This is the opportune time to implement any custom logic you may require by running verification against the values that have been extracted for the fields defined.

Example Scenario:

You may wish you to retrieve the extracted value from one field, perhaps a Social Security Number, and use it to perform a look-up operation to an external database, retrieving an associated name. You could then in turn us the results of these SQL query to populate the values of other document level fields defined in Ephesoft.

Example location: {Ephesoft_install_directory}\SharedFolders\BC1\scripts

Example file: ScriptAutomaticValidation.java

ScriptDocumentAssembler.java

The Document Assembler script is executed in the Ephesoft Batch Class work flow following the Page Processing Module, and Prior to reaching the Document Review stage. At this point the batch .xml has undergone Ephesoft’s classification routines and the batch’s contents are structured into documents, with confidence scores assigned. However, perhaps you have a unique situation where the default Ephesoft classification behavior alone will not organize your batch’s documents as your require. This script is the ideal location to implement any logic to customize the classification organization of your batch. Although Document Level Fields are not yet present in the batch .xml at this point, page level fields are making Script

Example Scenario:

You may be using cover sheets to aid in the classification accuracy for your documents. However by the time the work flow reaches the ScriptDocumentAssembler Ephesoft’s classification routines have already worked their magic and you may no longer have any use for the cover sheets. You can use this script to define some logic to remove the first page of every document, which in this case would be the cover sheets.

We’ve provided as an example resource, a script that does exactly this: ScriptDocumentAssembler_remove-1st-page.java

ScriptExport.java

The Export script is executed in the Ephesoft Batch Class work flow during the processing of the Export Module. At this point all of Ephesoft’s separation, classification, extraction, and validation have been performed and the batch is in the process of leaving the Ephesoft system. Consequently, ScriptExport.java is the ideal place to implement logic facilitating custom export requirements.

Example Scenario #1: As a batch is leaving the Ephesoft system, you may intend to import its .xml and image files into a document repository system. Your targeted system may have its own internal XML schema for describing its contents, and to make the transition a seamless one you want to consider applying an XSLT translation to the Ephesoft batch .xml so that it can be automatically imported and recognized by its destination system without manual effort.

Example Scenario #2: Perhaps you have a specific document management system such as FileBound in mind. FileBound uses Divider and Separator values to index its contents. Ephesoft provides a FileBound Plugin in the Export Module. However, in addition to this you can implement logic in the ScriptExport.java file to populate the batch documents’ divider and separator fields based on a captured extraction value, barcode, or other means. Through Ephesoft scripting you could use an extracted barcode value as a look up key in a SQL query to an external database table to retrieve the appropriate divider and separator values for a given document type.

Example location: {Ephesoft_install_directory}\SharedFolders\BC1\scripts

Example file: ScriptExport.java

ScriptExtraction.java

The Extraction script, although similar in sequence position to the ScriptAutomaticValidation.java, is useful for the purpose of separating extraction from validation.

Example Scenario:

Assume you have some OMR field extraction defined to extract check boxes denoting credit card type. For example there could three boxes total, signifying a choice of visa, american express, or mastercard. If filled out correctly the form should only have a check mark in one of the boxes. RecoStar OMR extraction will represent these three check boxes as a three character string of binary values, with the box containing a mark being represented by a “1” value (the others, “0”). Your Extraction script function could analyze the binary values to determine which of the three credit card vendors is being represented and set a document level field value to a string value of “visa”, “amex”, or “mastercard”.

Example location: {Ephesoft_install_directory}\SharedFolders\BC1\scripts

ScriptFieldValueChange.java

The Field Value Change script can be toggled through the Ephesoft Validation Module, and when enabled will fire when the value of a field is changed in the user Validation View. This can be extremely useful if you want to have the changes you make to one field automatically produce a change in value of one or more other fields.

Example Scenario #1:

Consider the case where you have a field that is of the drop down list type. This field contains a list of various departments within an organization (eg: HR, IT, etc). In addition to this field you have another drop down field that serves as a list of users. You can use the Field Change script to implement logic such that change the department value for field #1 will automatically update the drop down list of field #2 with users that correspond to that newly selected department.

Example Scenario #2:

Perhaps you have had a document arrive in Validation View with a loan number field that has been extracted, and some corresponding fields that contain information related to the loan number. However, consider if the loan number is incorrect, and your user manually needs to change it. Instead of having to also manually look up and change all of the corresponding fields, the Field Change Value script could make it so that changing the Loan Number field value automatically performs a look up operation to a database and populates the additional fields with the information on file for that loan number.

Example location: {Ephesoft_install_directory}\SharedFolders\BC1\scripts

Example file: ScriptFieldValueChange.java

FunctionKey.java

The Function Key script allows for multiple methods to be defined within the FunctionKey.java and have these individual methods bound to keys on the users keyboard to act as keyboard shortcuts for executing pieces of custom functionality.

Example Scenario:

Consider that you may have a default set of values for a given document type that you want the option to populate its fields with in Validation View at the push of a button. In FunctionKey.java you would implement a method to set the fields of that document type to a set of default values. In the Ephesoft Validation Module you can define the Function Key that you want to associate with this method. You must specify both the name of the function as well as the key that you wish you bind it to. Having done so you should now see the Function Key that you specified as an icon in the Validation View. The custom function key method can now be invoked by clicking this button or striking the specified key itself.

Example location: {Ephesoft_install_directory}\SharedFolders\BC1\scripts

Example file: ScriptFunctionKey.java

ScriptPageProcessing.java

The Page Processing script is useful for conducting operations on the XML representation of a batch’s pages before they have undergone classification and encapsulation into documents.

Example Scenario:

To reduce batch processing time it is possible to use ScriptPageProcessing to remove pages that are ‘garbarge’ and don’t contain valid OCR data. You could implement a function that would iterate through the collection of pages, and from each page element retrieve the corresponding OCR file (.html) and image file name. If the OCR data for the page is nonexistent, and the original image size is below a certain threshold you can deem the page to be junk and remove it from the batch .xml. By removing these useless pages your batch will be able to traverse the rest of the batch class workflow more efficiently and with an improved processing time.

Example location: {Ephesoft_install_directory}\SharedFolders\BC1\scripts

ScriptValidation.java

The Validation script differs from the Automatic Validation script in that it is run during the user Validation User Interface experience, where as Automatic Validation executes and performs custom validation steps immediately before the batch is presented to the user in the Validation UI. The benefit is this is that as the user is making changes to the document field values in the Valdiation UI, the Validation Script can be triggered to run after each change to ensure that the changes are put through custom validation processing requirements.

Example Scenario:

You may have some a document level field, AccountNum, where the value being extracted should correspond to an existing account number in an external database. Perhaps due to poor image quality, the OCR’d value for the account number is either incomplete or incorrect and so the document appears in Validation with its field highlighted in red. The user is able to see the corresponding image and keys in what they believe to the the account number appearing on the image, but you want to ensure that they haven’t made a mistake and what they are inputting is indeed a valid account number. In this case it is possible to implement a function that takes the value of the AccountNum field and performs a database look up to verify that the value does in fact exist. This check can run each time after the user has modified the AccountNum document field value and attempts to save their changes.

Example location: {Ephesoft_install_directory}\SharedFolders\BC1\scripts

Was this article helpful to you?

Rene Hernandez