Create rules to map values for fields in XML invoices
Relatively simple to very complex rules can be used to map values in XML invoices to the correct fields in the corresponding XML invoice definition or profile to help Kofax ReadSoft Invoices automatically process invoices that belong to them. These options can be used to create rules:
- Disable extraction – remove a field from the invoice.
- Use standard rules only – indicate the direct path to a specific element in the XML
- Use advanced rules – rules are made up of conditional expressions that can be easily created for desired fields in an XML invoice definition using the XML Mapper
- Use XSL – XSL syntax is used to describe how the value is derived. This can be written from scratch. Alternatively, the corresponding XSL can be imported for an existing advanced rule. In either case, a good knowledge of XSL syntax is required.
Whenever you use XSL to get a desired value, be sure to test the output when the data contains special characters (such as &).
To display special characters normally (an ampersand character, &, would be displayed as &, for example), add <xsl:output method="text" /> to the XSL snippet in this way.
If this code is not added, the ampersand would be displayed as &.
- To find information on the location and keywords, etc., that are currently specified for a field in the profile, select the field to the right on the corresponding tab, select the Field mapping rules tab on the left of the window, and expand Field profile properties.
- For additional ideas on
how rules can be used and implemented (or to see what a previous rule created
looks like), look at existing rules that are defined for various fields for the
standard used in the invoices you receive. To do this, open the
Fields tab in the XML Mapper and look for
fields for which a rule is defined. You can tell by the appearance of the
button to the right of the field:
– a rule is defined.
– no rule is defined.
To create rules to map values for fields in XML invoices
- Open the Optimize module.
- Double-click the invoice profile that contains the invoice definition that you want to optimize.
- In the list that is displayed, double-click an XML invoice definition that needs optimization (the cell in the Optimize column may read 99, for example). The XML Mapper is displayed.
Continue with one of these sections:
Using standard rules only (default)
Standard rules can be used if there is one clear candidate for a value (among multiple candidates if listed).
Field mapping rules tab, select
Use standard rules only.
Select a candidate from a list of multiple candidates directly in the Fields tab to the right on the screen. Or, on the XML tab, right-click the appropriate value and select Map element value to the selected invoice field: <field name>.
- Click Extract to ensure that there are not still multiple candidates. If there are, use advanced rules or XSL to further specify which of the candidates is the correct one.
Using advanced rules
Advanced rules are useful when there are multiple candidate values with the same path in the XML or when multiple conditions are required to describe when/how the value for a field should be extracted.
Here are several examples of how advanced rules can be used:
- The XML contains multiple values that match the basic path/expression.
- Specifying a constant value for a field.
- Translating an XML value to one that Kofax ReadSoft Invoices understands.
- Selecting node X based on node Y (or on attribute a)
- Selecting node X if it exists and node Y if it does not exist.
- Correcting a misspelled field name in connection with master data
A good knowledge of XSL syntax is needed if you want to use it to modify extracted values. However, you can get started by importing and then modifying the XSL equivalents of advanced rules that are already defined. Examples: