Text matching with keyword lists
If the page on which you are text matching has too many variations on the page, regular expressions might be unwieldy. A keyword list might be a better option.
Some labels might have more variability than you can address by using regular expressions. For example, if you are processing invoices from different vendors, one company might use the label Total Cost, another might use Amount Due, and another might use Invoice total.
The Locate library provides actions to do text matching by using either a keyword text file or a database.
| Library | Action | Description |
|---|---|---|
| Locate | FindKeyList | Locates the first (or next) occurrence of a word or phrase that matches one of the entries in a keyword file. |
| Locate | FindLastKeyList | Locates the last occurrence of a word or phrase that matches one of the entries in a keyword file. |
| Locate | FindDBList | Locates a word that matches one of a list of words that are obtained from a SQL query. |
In the invoice example, you can include all three labels
and any others in a keyword text file. You can then use FindRegExList to
locate the matching field. The keyword file must be a plain text file
with the extension .key. The file must be in
the application dco_application_name folder, unless
you specify the full path to an alternative location. An example file
might be named TotalCost.key and include variations
on the theme such as:
- Total Cost
- Total cost
- TOTAL COST
- Amount Due
- Amount due
- AMOUNT DUE
- Total Amount
- Total amount
- TOTAL AMOUNT
- Total amount due
- Total Amount Due
- TOTAL AMOUNT DUE
- Invoice total
- Invoice Total
- INVOICE TOTAL
Tip: You can also include regular expressions in the keyword
list.