Templates - Workflow Concept
Visual templates are the top level paradigm for setting up data extraction projects in auto mode. Auto Mode is the default operating mode. In auto mode, TextConverter allows you to visually create templates with fields to capture (or trap) data.
Basic setup with single output table
As an example, we will use a sample invoice (below), in which the line items represent the detailed information, and the invoice-related information that would represent a higher level.
Figure 1. Sample invoice with the highlighted data levels
Configuring the Detailed template
Generating fixed positional input fields. By default, TextConverter has one ‘Detailed’ template. More templates of both types (‘Detailed’ and ‘Top-level’) could be added at any time. The user can also change the templates’ type and position as needed, but the ‘Detailed’ templates should be always to the right of the ‘Top-level’.
Usually, it is more convenient to start configuring projects with detailed data. Therefore, in this example, we will use the default ‘Detailed’ template for extracting the line items' data.
There are two main techniques used for extracting data: fixed positional or tag-based. The following example utilizes the fixed positional technique. To set up the fields in the detail template, select a representative row(s) containing the detailed data and use the fly-menu (right-click) or a corresponding toolbar button to “Setup fields from the selected line(s).”
Figure 2. Configuring the Detailed template using the fixed positional technique.
This action automatically generates and configures the appropriate number of input and output fields and connects them to each other. In the process, it analyses the extracted data, detects and sets up both the input and output fields’ type. The output preview shows the extracted data as a database table. The number of input lines (or pages) used for the dynamic preview is defined in the Options pane (‘Lines/Pages for Preview’).
Figure 3. The fields are added to the Input and Output fields.
Naming the fields. Right click on the line containing the column names (line 10) and call the ‘Assign field names’ command (or use the corresponding toolbar button) to update the field names.
Figure 4. Assigning the field names.
This action replaces the default input and connected output field names with the once extracted from the selected line. The names are extracted using the same rules as were used for the main data extraction. The output column names changed accordingly.
Figure 5. The default field names are replaced with the names obtained from the input report.
To make the project more intuitive we will change the default template name ‘D1’ to ‘Items’. The template names could be changed at any time. Please, keep in mind that in cases when template names are used in script, changing them will generate an error and will require making appropriate adjustments in script.
Figure 6. Replacing the Detailed template’s default name.
This concludes the configuration of the line items extraction part.
Configuring the Top level template
Adding the top-level template. Use the ‘Add top level template’ fly menu command (or the corresponding toolbar button) to add a new top-level template.
Figure 7. Click the “Add a top level template” button to add a top-level template.
The new top-level template tab with the default name ‘L1’ is added to the left of the ‘Items’ template tab. The text associated with the configured ‘Items’ template is grayed out to make the new templates’ configuration process more convenient.
Figure 8. Select the text that will be tagged and use the fly-menu to add the tag.
Adding input fields. This template will be responsible for extracting the Invoice related data, therefore let us rename it to ‘Invoices’.
Although both fixed positional and tag-based data extraction methods could be applicable, we will start with the tag-based fields. The tag-based fields could be added using several different techniques and for demonstration purposes, we will add fields each time using a different one.
Let us start with extracting the invoice number use the ‘Add tag’ technique. For that, we will use the “INVOICE:” string, positioned before the invoice number, as a tag. Let us highlight the “INVOICE:” string and call the ‘Add tag’ fly menu command (or the corresponding toolbar button).
Figure 9. Using the ‘Add tag’ command for the “INVOICE:” tag.
The ‘INVOICE’ field was added to the input and output field lists (dictionaries) and connected to each other. Each template has its own Input dictionary.
Figure 10. Adding the invoice number field .