# Value Mapping

TIP

While very useful, Value Mappings are not required to use DX2. Value Mappings modify domain-specific data as Documents are transferred between Trading Partners.

TIP

Value Mappings make use of XPath, a query language for selecting nodes from an XML document. To learn more about XPath, see this tutorial on W3Schools.

Value Mappings are an indispensible tool for ensuring that product codes and other business-specific information makes just as much sense to your other Trading Partners as it does to you.

Taking a simple example, imagine that you receive an invoice for one desk chair. To the supplier from whom you are purchasing this desk chair, its item code is SUPP-CHAIR-123. Your business (and/or its ERP) has this desk chair listed, but under the code ERP-CHAIR-321. To have to work through every invoice that has this chair listed and change its item code can be tiresome and error-prone, not to mention that you may have many more products for which this needs to happen.

Value mappings aim to solve this issue through automation. Given a specific item in a Document received from another Trading Partner, a value mapping automatically converts it, given a previous value and a new value, both specified by you.

Value mappings demonstration

# Understanding Value Mappings

Name: The name of a Value Mapping is a human-readable field, purposed to allow for quick recognition of the purpose and function of a Value Mapping. Short names tend to work best here for the sake of reading.

TIP

The name of a Value Mapping must be unique to your Trading Partner.

Document Type: A Value Mapping is tied to one Document type. Only Documents with the same Document type will be processed with the mappings you specify.

TIP

You cannot change the Document type of a Value Mapping once it has been created. Selecting an incorrect Document type here entering many mappings may require repetitive work to re-type them into another Value Mapping.

Source XPath: The XPath query with which to look up an element in the source Document. The value of this element is then used as the input in this Value Mapping. As an example, if the Source XPath is set to cbc:UBLVersionID, and an input Document has an element matching this selector, its value is translated as per the configured mappings. Clicking into the Source XPath field presents a list of suggestions from which you can pick commonly chosen fields. Alternatively, if you know what XPath you need to create your Value Mapping, you may type it into this field.

Destination XPath: The XPath query which determines where the element found using Source XPath should appear in your Document. As with the Source XPath field, clicking on this field will show a list of suggested XPath queries, but free entry is permitted.

Value mappings structure

Value: This field appears for each mapping you add to your (parent) Value Mapping. This determines what input values should trigger the Value Mapping to replace Document content, and what this input value must be to then be replaced with another specific value.

Replace With: As with the relationship between Source XPath and Destination XPath, when a specific Value is found in the specified location within a source Document, it should be replaced with a specific value. This replacement value is determined using the Replace With field.

TIP

Value Mappings will only ever operate on input data matching all of the conditions you specify on this page, including the Value field. Specifying an invalid Value here is an error that cannot be detected by DX2, and may cause system issues that are difficult to diagnose. Ensure careful entry into mapping fields to avoid these issues.

Last Updated: 21/03/2019, 2:45:40 am