Removing non-line items from the page data file

The region that is defined for the line item grid might include fields that are not line items. For example, the Total field that you used for text matching is not a line item. Therefore, Datacap might create line items for items that are not line items.

About this task

In the following invoice example, although there are only two line items on the invoice, Datacap created a third line item for the Total field.

Item Descript Cost
1176 Widget $6.95
9122 Widget $8.25
  Total $15.20

The following is the XML code for the invoice example.

<P id="TM000001">
<F id="Grid_region">
       <F id="Line_item0">     <--First line item
          <F id="Item"> etc.</F>         <--Has the value "1176"
          <F id="Description"> etc.</F>  <--Has the value "Widget"
          <F id="Cost"> etc.</F>         <--Has the value "6.95"
       </F>
       <F id="Line_item1">     <--Second line item
          <F id="Item"> etc.</F>         <--Has the value "9122"
          <F id="Description"> etc.</F>  <--Has the value "Widget"
          <F id="Cost"> etc.</F>         <--Has the value "8.25"
       </F>
       <F id="Line_item2">     <--Third line item (not a line item)
          <F id="Item"> etc.</F>         <--No data
          <F id="Description"> etc.</F>  <--Has the value "Total"
          <F id="Cost"> etc.</F>         <--Has the value "15.20"
       </F>
       etc.

Procedure

  1. If the page you are processing has non-line item fields within the grid region, you might need to identify those non-line items and remove them. Datacap includes an action to identify and remove these items for you.
    Library Action Description
    Validations CheckSubFields Confirms that values exist in child fields of specified parent field. Deletes the parent field if any of the specified child fields have no values.
  2. You must attach the rule to the line item grid object in the document hierarchy and ensure that the rule runs after recognition is complete. Use one of the following methods to attach the rule:
    • Include the rule in the Recognize ruleset and attach it to the Close element of the line item grid object.
    • Include the rule within a separate task profile that runs after recognition but before validation; for example, the Clean ruleset. Attach the rule to the Open element of the line item grid object.

    When you use either method, Datacap recognizes that the Item field in the third line item has no value. Therefore, Datacap deletes the field, leaving only the two real line items.