Advanced Document Processing (FlexiCapture) Sample

The sample Reading Robot solution is built with two projects that enable robots to:

Send documents to the FlexiCapture service.

Monitor the document batches and process the events that are returned. The extracted content from the documents is returned in XML. This may then be parsed for use.

Before You Begin

Using this functionality assumes that you have a FlexiCapture Server account setup and that you have defined your document templates.

For details on the FlexiCapture library objects, see Advanced Document Processing Library Objects.

Sample Projects

You can download a zip file with the two projects that make up the sample projects here. These are intended for guidance and testing purposes only. This includes a batch monitor project and a send documents project.

To test this example, ensure that you have a ABBY project called SampleProject with a GenericInvoiceReading batch type.

Create a directory and copy the BestOfficeSuppliers_HS_01.tif file into the directory.

Send Document Sample

The FlexiCapture_SendDocument sample project has two event handlers defined, with a corresponding callout for testing purposes. It also has the required instances of the FlexiCapture business entities, as well as several built-in instances.

To use the sample project, enter your initial values in Password inst, ServerAddress inst, and Username inst.

Create a directory and copy the BestOfficeSuppliers_HS_01.tif file into the directory. Modify the initial value of the FilePath_InvoicesValid01 business entity instance, for example, D:\RTI\Connectivity\FlexiCapture\SampleImages\GenericInvoiceReading\BestOfficeSuppliers_HS_01.tif.

To view the batch monitor sample project:

1. The sample project includes the following business entity instances:

Batch Type inst: The type of batch to process. Set to an initial value of GenericInvoiceReading.

File Path inst: The file path (including the file name). Set to use the value in FilePath_InvoicesValid01. You can change this to one of the other File Paths if you want to test other documents.

File Paths: Four different file paths. We will us FilePath_InvoicesValid01 to demo the functionality.

FlexiCapture Batch Context inst: An instance of FlexiCapture Batch Context.

FlexCapture Service inst: An instance of FlexiCapture Service.

Get Batch Type Names - Res: List of Text.

Get Project Names - Res: List of Text.

Get Property Value - Property Name param: A text instance used with the Get Property Value to show the properties of the Batch Context. For example, in this sample project, File Name and QA.

Get Property Value - Property Value result: A text instance for the Batch Context property value.

IsConnected: Used to check if connected to the FlexiCapture Server.

Process Document function's Result: A number.

Project Name inst: Set to an initial value of SampleProject.

Process Document Result inst: An instance of FlexiCapture Process Document Result. The extracted content from the document(s) is returned in XML. This may then be parsed for use.

Results: List of FlexiCapture Process Document Result.

Start Trigger: A Boolean instance.

User Properties of Batch Context inst: An instance of FlexiCapture Batch Context.

Text user instances for the FlexiCapture Server: Password inst, ServerAddress inst, and Username inst.

To use the sample project, enter your initial values in Password inst, Server Address inst, and Username inst.

2. The sample project includes an onStart Trigger Changed event handler, which performs the following functions:
a. Connects to the FlexiCapture service, by executing the Connect function of the FlexCapture Service inst, and specifying the Server Address, Username, Password and whether to Use HTTPS.

You may want to assign the return value of the Connect function to a business entity instance in order to verify that the monitor has connected to the FlexiCapture service, for example, IsServiceConnected.

b. Executes the Add Property function (File NameFile Name inst) of the FlexCapture Batch Monitor inst.
c. Executes the Add Property function (QASasha) of the FlexCapture Batch Monitor inst.
d. Sends the document for processing and assigns the resulting number to Process Document function's Result, by executing the Process Document function of the FlexiCapture Service inst and passing it the Project Name inst, Batch Type inst, File Path inst, and FlexiCapture Batch Context inst.

3. The StartCallout callout is used to test sending documents.

When you run the project, select Start Processing the Document.

To test the sample project:

1. Open FlexiCapture_SendDocument.

To use the sample project, enter your initial values in Password inst, ServerAddress inst, and Username inst.

Create a directory and copy the BestOfficeSuppliers_HS_01.tif file into the directory. Modify the initial value of the FilePath_InvoicesValid01 business entity instance, for example, D:\RTI\Connectivity\FlexiCapture\SampleImages\GenericInvoiceReading\BestOfficeSuppliers_HS_01.tif.

2. Run the project.

The StartCallout appears.

3. Select Start Processing the Document. The Result (Batch ID) appears, for example, 854.

4. Click Get Project Names and Get Batch Type Names. This returns the project names and batch type names on the FlexiCapture Server.

5. To view a property value, enter the Property name, for example, QA, and click Get Property Value. This returns the property value, for example, Sasha.

6. Click Stop RT Client.
7. Open the FlexiCapture_BatchMonitor project.

To use the sample project, enter your initial values in Password inst, Server Address inst, and Username inst.

8. Run the project.
9. Expand the Monitor to see the results.

Batch Monitor Sample

The FlexiCapture_BatchMonitor sample project has several event handlers defined, with corresponding callouts for testing purposes. It also has the required instances of the FlexiCapture business entities, as well as an instance of a user-defined type and several built-in instances

To use the sample project, enter your initial values in Password inst, Server Address inst, and Username inst.

To view the batch monitor sample project:

1. The sample project includes the following business entity instances:

FlexiCapture Batch Monitor inst: An instance of FlexiCapture Batch Monitor.

FlexCapture Service inst: An instance of FlexiCapture Service.

List of "FC Batch Content": List of FlexiCapture Batch Context.

List of "FC Process Document Result": List of FlexiCapture Process Document Result. The extracted content from the document(s) is returned in XML. This may then be parsed for use.

[Optional] Custom user type to store monitor and service status results, for example, Functions Results with IsServiceConnected, IsServiceDisconnected, Monitor - Started, Monitor - Stopped.

[Optional] Boolean user instances for DoDisconnect and DoReconnect to use if you want to, for testing purposes, disconnect or connect from inside a callout.

Text user instances for the FlexiCapture Server: Password inst, Server Address inst, and Username inst.

To use the sample project, enter your initial values in Password inst, Server Address inst, and Username inst.

2. The sample project includes an OnSolutionLoaded event handler for when the solution is loaded:

For testing purposes, executes the APA Monitor.exe. This runs the Monitor when the solution loads.

Specifies the project to monitor, by adding an item to the Projects to Monitor list in the FlexCapture Batch Monitor inst. (If you do not specify which project to monitor, the monitor will monitor all projects.)

Starts the FlexiCapture Batch Monitor, by executing the Start function of the FlexiCapture Batch Monitor inst, and specifying the Server Address, Username, Password and whether to Use HTTPS.

You may want to assign the return value of the Start function to a business entity instance to verify that the monitor has started, for example, Monitor - Started.

Connects to the FlexiCapture service, by executing the Connect function of the FlexCapture Service inst, and specifying the Server Address, Username, Password and whether to Use HTTPS

You may want to assign the return value of the Connect function to a business entity instance to verify that the monitor has connected to the FlexiCapture service, for example, IsServiceConnected.

Shows the OnStartCallout (for testing purposes).

3. The sample includes an event Batch Monitor - Batch Processed which is triggered if the batch is processed.

Shows the Callout_Batch Processed (for testing purposes).

Adds the Download Batch Results of the FlexCapture Service inst to the list of FC Process Document Result. It adds the Project Id, Batch Id and Batch Context.

Adds the Batch Context to the List of "FC Batch Context".

4. The sample includes event handlers for various other events:

Batch Monitor - Batch Failed: Triggered if the batch fails.

Batch Monitor - Batch Should be Verified: Triggered if the batch should be verified by a person.

Batch Monitor - Connection Lost: Triggered if connection to the FlexiCapture Server is lost.

Batch Monitor - Connection Restored: Triggered if the connection to the FlexiCapture Server is restored.

onDoDisconnect: Triggered if you click in the sample project to disconnect.

onDoReconnect: Triggered if you click in the sample project to reconnect.

5. For testing purposes, display appropriate callouts when the events are triggered.