Log out?

eiConsole Intermediate – Transformation / Data Mapping

eiConsole v.21R1
Tutorial & Interface

Using Functions


In this tutorial, we’ll cover the use of XPath and XSLT functions in the Data Mapper to perform name concatenation for the Target format. This tutorial expands on concepts covered in “Data Mapping Using Conditions,” so users are expected to be familiar with that material.

How to Use This Example

Click the links below for the files you will need for this tutorial, then download the INTERFACE to get started. (Once logged into the eiConsole it immediately shows up in your “PIE” inbox for use.)

icon_sample-dataSample Data 1
icon_sample-dataSample Data 2
icon_downloadInterface Download

Note: if you are not logged in to the eiConsole, or have arrived at this page via a browser, you will be prompted to log in before the Interface downloads into your eiConsole “PIE” inbox. Or if you have not downloaded and installed a FREE eiConsole Trial you will have the opportunity to register after you click the Interface Download link. Once you are logged in, the interface will automatically download into your “PIE” inbox. First, you’ll see a screen pop up indicating that a new product is ready for download. Select the Download Now button. Once you’ve downloaded the Interface you can drag it into your current Working Directory and begin.

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 Route

Begin by creating and configuring a Route as in the previous tutorial. Add a new Format named “PeopleA XML to PeopleD XML,” select it on the Target Transform stage, and uncheck “Use Direct Relay”:

Click “New” to open the Data Mapper. Load “PeopleA.xml” for the Source format and “PeopleD.xml” for the Target format:

Repeat the mapping exercise from the previous tutorial, with the exception of leaving the various “name” elements unmapped:

Mapping Name Values

Map “FullName” from the Target onto the “Female” and “Male” elements in the center:

We’ll map the First, Middle, and Last name values onto FullName, but we also want them to be separated with spaces. While we can do this using additional XSLT instructions, we can also make use of one of the many functions provided by XPath. Under XPath Functions → String, drag “concat(string, string+)” onto “FullName”:

After dropping the Concat Node onto the mapping, a dialog box will pop up asking you how many concat elements you wish to add. Select the number 3 and click OK.

This will create an XSLT instruction called “value-of” and populate it with a “concat” function call. “concat” accepts any number of arguments and concatenates their literal values together. The Data Mapper will create a “concat” entry in the mapping panel with the number of child elements you selected in the previous dialog. You can drag-and-drop values onto these children to concatenate their values together.

We’ll start by mapping “First” under “Name” onto the first element in the “concat” function:

Next, repeat this process for the “Middle” node under “Name”, dragging it onto the second “Value” element in the “Concat” function. We could do the same thing for “Last” as well, but drag & drop is not the only way to fill in this function. We can also do it manually.

To manually add a value, double-click on the last “Value” element in the “Concat” function. A text field will open in the node. Enter “Name/Last” in the text field, and don’t forget to hit enter when you’re done.

Now your “Concat” mapping should look like the next screenshot below, with First, Middle, and Last name mapped to it. There’s just one thing missing, though: there are no spaces between the words. If we executed the transformation now, the value assigned to “FullName” would be “FirstMiddleLast”, are all a part of one word. We obviously don’t want that, but how do we add the spaces? We’ve filled up all three elements in the function.

Fortunately, there is another way to manually modify the function.

Adding more Parameters Manually

Double-click on the concat() “select” attribute to open its text box. In it, you see the raw XSLT code of the function: “concat(Name/First,Name/Middle,Name/Last)”. We need to add spaces between each word, so to do so add an additional element in between each word with the text ‘ ‘. When you are done, it should read: “concat(Name/First,' ', Name/Middle, ' ', Name/Last)

Don’t forget to press enter, and your function should now look like the screenshot below.

XSLT and XPath provide numerous other functions, all of which are available in the tool palette at the top of the Data Mapper screen. Test the mapping and you should see the following for output:

Congratulations! You’ve learned how to use XPath and XSLT functions in the Data Mapper. Next move on to Using Tabular Mappings for more advanced training.

This is a unique website which will require a more modern browser to work! Please upgrade today!