Tutorial & Interface
Using Tabular Mappings
This interface and related tutorials demonstrate the use of the Data Mapper in Route configurations to transform between XML Formats. In this particular exercise, an existing Route (from “Data Mapping – Using Functions”) is modified to transform a “PeopleA” XML format to the “PeopleE” XML format, which makes use of the Tabular Mapping tool to convert between Gender code sets. In the tutorial, we’ll cover using the “Tabular Mappings” feature of the Data Mapper to convert between Source and Target code sets. This tutorial expands on concepts covered in “Data Mapping Using Functions”, so users are expected to be familiar with that content.
How to Use This Example
Download the INTERFACE file and save it to your local disk.
Open the eiConsole, click on the File drop-down menu and select Import Working Directory/Route/Format. Highlight the name of the file to import and press the Import Selected button. The imported Interface will appear in your current Working Directory.
Next, follow the tutorial and walk through it step-by-step. You may check your work against the provided Route (Sample Data).
Creating and Configuring a New Route
Start by creating and configuring a new Route similar to the prior tutorial. Add a new Format named “PeopleA XML to PeopleE XML” on the Target Transform, and uncheck “Use Direct Relay”:
Click “New” to open the Data Mapper. Load “PeopleA.xml” for the Source and “PeopleE.xml” for the target:
Repeat the mapping exercise from the previous tutorial, or copy the XSLT using the “XSLT View” tab:
This mapping is pretty much identical to the last except for one detail: in the Source format, Gender is represented by “Male” or “Female,” while in the Target format, Gender is represented by “M” or “F.” Most formats that make use of similar, coded values do not share entry values. For example, one format might represent marital status with “Single” or “Divorced,” while in another format, those respective values could be “1” and “6.” While you can build out these conversions using the choose / when / otherwise instructions, there’s a much simpler way: Tabular Mappings.
Scroll down to the Gender mapping in the panel:
Adding Tabular Mapping
You can see that Gender gets its value from Gender in the Source. To apply a Tabular Mapping to this mapping, drag “Tabular Mapping” from Custom → Uncategorized onto it:
This will open the Tabular Mapping dialog, where you can select from a list of existing mappings:
Of course, we have no such mappings defined yet, so click “Define New” to open a dialog to create a new Tabular Mapping:
This dialog provides a field to name the mapping as well as a table of currently mapped values. If the Source or Target formats loaded in provide enumerations (such as from an XSD or specific industry-specific standards), then the Source and/or Target value columns will have rows pre-populated. As this is not the case for our sample, we’ll have to add rows manually. So we’ll start by naming our mapping.
Naming our Mapping
Next, click the “Add” button to define a new row:
The raised dialog will provide fields to enter the Source and Target values. Since we’re converting between “Male” / “Female” and “M” / “F” codings, provide “Male” and M” for the first row:
Click “OK,” then click “Add” again and do the same for “Female” and “F.” You should now have a table with two rows:
Next, we’ll need to define a “Default Value” – the value that is chosen if the Source “Gender” is neither “Female” nor “Male.” We’ll default to “Unknown”:
Finally, click “OK,” select the new mapping in the previous dialog, and click “Select”:
The resulting mapping element should now look like this:
Finally, drop into the XSLT view to see how the Tabular Mapping is handled:
If you scroll further down, you can see the implementation of the “template,” which is called here to see the choose / when / otherwise logic that the Tabular Mapping tool generated automatically:
As you can see, Tabular Mappings are a powerful tool for handling conversions between code lists and values and can save you considerable amounts of time as you tackle more extensive mappings.
This concludes the tutorial.