Advanced XML rule example: Correct a misspelled field name in connection with master data

When master data is used, field names in the XML code for incoming invoices that belong to it need to match exactly with what is found in the master data. For this example, let us assume that while processing XML invoices, you notice that some of the invoices end up in Verify because the buyer name is misspelled and as a result, a match is not found in the master data.

To create an advanced rule to accept these invoices despite the misspelling of the buyer name:

  1. While optimizing the invoice profile or definition, expand the Buyer section on the Fields tab of the XML Mapper (on the right side of the window) and select the Name field.
    • Click the button to the right of the value:

      if no rule has been defined, or

      if there is already an existing rule for the field.

  2. Select Use advanced rules (to the left in the dialog under Definition of advanced mapping rules).
  3. In the XML node selection box of the Advanced rules section, navigate to and click the node indicated for the Name field. You can see the path to the field in the code by expanding Field profile properties directly under the Name at the top of the dialog. Then click Select to the right of the box.
  4. Now we need to set up the condition for the rule. In the Settings for new condition group, select Based on value as the base condition, Equals as the value comparison, and either click the dropdown list under Value to compare with and select the value that is found there if it is the incorrect value, or type in the incorrect value you want to program to look for. Click Add. The corresponding script for the rule is added to the Conditions to work with box. Click that condition to select it.
  5. Under Settings to define how the invoice field value is set, select if condition is true and type in the correct text (exactly as it is found in the master data - see tip below *) under Use value below. Click Add to add the rule to the Rules applied to map this field box.
    • If you realize that you entered the text incorrectly after having added the text to the rules box, simply type in the correct value again under Use value below  and click Add. Then click the incorrect rule to select it, and click Del to delete it.
    • You can also include other incorrect variations of the buyer name in the rule if desired. To do this repeat step 4 typing the next incorrect variation in the Value to compare with box, but instead of clicking add for these variations, click OR. The text is then added automatically to the text for the rule in the Rules applied to map this field box.

      *  Tip! To make sure you get the exact spelling for a buyer or supplier name, for example, click the corresponding text, Show buyers or Show suppliers, to the right in the window on the Fields tab of the XML Mapper. In the dialog that is displayed, click the name of the buyer/supplier in the table and press Ctrl+C to copy the text. You can then paste the name directly in the Use value below box by pressing Ctrl+V.

Click Extract and review the image to check the results. If you need to modify the rule, you need to click it in the Rules applied to map this field box, click Del to delete it, make the changes needed to fix the rule, and click Add again to add the modified rule. If you need to modify a condition, the process is the same (and if a rule is based on it, the rule is also deleted if you delete the condition).

Consider if the change(s) should apply to all invoices or only those for the current XML invoice definition. Click Save XML definition to save the change for the current XML invoice definition only (that is, the current supplier). Click Save XML profile if you want the rule to apply to all XML invoices that match the XML invoice profile regardless of the XML invoice definition.

Other advanced examples:

Formatting an extracted XML value with XSL

Modifying an extracted XML field value with XSL

Removing hyphens (-) from an extracted value

Select node X based on node Y (or on attribute a)

Selecting a specific node when more than one node matches after using a standard rule

Selecting node X if it exists and node Y if it does not

Specifying a constant value for a field

Summarize data from line items as a note in a summary invoice

Translating an XML value to one that Kofax ReadSoft Invoices understands