Using Value-Maps Print this Topic Previous Page Up One Level Next page

Home >  Designing Mappings >

Using Value-Maps

The Value-Map component allows you to transform an input value to a different output value using a lookup table. This is useful for converting different enumeration types. The component has only one input and one output item.


Note:If you want to retrieve/filter data based on specific criteria, please use the Filter component, see Filters and Conditions.



To use a Value-Map component:

1.Select the menu option Insert | Value-Map, or click the Value-Map icon ic-valmap in the icon bar.


2.Double-click the Value-Map component to open the value map table.


3.Click into the column headers and enter Weekday input in the first, and Day of the Week in the second.


4.Enter the input value that you want to transform, in the Weekday input column.
5.Enter the output value you want to transform that value to, in the Day of the week column.
6.Simply type in the (new entry) input field to enter a new value pair.
7.Click the datatype combo box, below the column header to select the input and output datatypes, e.g. integer and string.


Note:Activate the Otherwise check box, and enter the value, to define an alternative output value if the supplied values are not available on input. To pass through source data without changing it please see Passing data through a Value-Map unchanged.


8.You can click the edit icons in the header rows to change the column names, which are also displayed in the mapping. This will make it easier to identify the purpose of the component in the mapping.


The Expense-valmap.mfd file in the ...\MapForceExamples\Tutorial\ folder is a sample mapping that shows how the Value-Map can be used.


What this mapping does:

Extracts the day of the week from the Date item in the data source, converts the numerical value into text, and places it in the Weekday item of the target component i.e. Sunday, Monday etc.


The weekday function extracts the weekday number from the Date item in the ExpReport source file. The result of this function are integers ranging from 1 to 7.
The Value-Map component transforms the integers into weekdays, i.e. Sunday, Monday, etc. as shown in the graphic at the top of this section.
If the output contains "Tuesday", then the corresponding output "Prepare Financial Reports" is mapped to the Notes item in the target component.
Clicking the Output tab displays the target XML file with the transformed data.


Note:Placing the mouse cursor over the value map component opens a popup containing the currently defined values.


The output from various types of logical, or string functions, can only be a boolean "true" or "false" value. The value you want to test for, must thus be entered into the input field of the value map table e.g. "true".

© 2019 Altova GmbH