Integration Engine Solutions to Connect Anything to Anything

Log out?

eiConsole v.24R1
Tutorial & Interface

eiConsole – Data Mapping & Transformation

Using Iteration

Note: The Quick Start, Foundation, and Topology tutorials should be completed before proceeding with the Data Mapping & Transformation Tutorials.


Overview

This tutorial will cover how to use the for-each instruction in XSLT to perform iteration over elements. This tutorial extends on concepts covered in How to Create a Simple Mapping, so users are expected to be familiar with that material.


Before You Begin

Zip File IconUsing Iteration
Working Directory

Download the Using-Iteration-Working-Directory.zip file with the sample Working Directory and unzip it on your computer to a convenient place. In our case, it’s c:\Users\{USER _NAME}\PilotFish eiConsole Working Directories\Using Iteration where {USER_NAME} is the user’s name.

Open the eiConsole, browse your Using Iteration directory, and open it. The fully configured Data Mapping – Using Iteration route is included in the Working Directory. Your Route File Management screen will open, as shown below.

Next, follow the tutorial and walk through it step-by-step. You may check your work against the provided Route sample data.


Double-click on Data Mapping – Using Iteration.


Creating and Configuring a New Format

Start by creating and configuring a new Format. Name it PeopleA XML to PeopleA XML.


Uncheck Use Direct Relay and click New to open the Data Mapper.


For this mapping, load in PeopleA.xml for both the Source and Target formats. You can find it in c:\Users\{USER _NAME}\PilotFish eiConsole Working Directories\Using Iteration\data. Select XML from the format reader.


Click the Read Format button.


Then select XML from the Read Format drop-down list and read the “PeopleA.xml” as the Target.


Click the Read Format button.


Now your Data Mapper should look like the screen below.


Map People from the Source onto the stylesheet element in the center data mapping panel and then map People from the Target onto the People now in the center panel.


Data Mapping Each Person

In the previous tutorial, we mapped only the first Person onto the Target. This time, we’ll map each Person from the Source to a corresponding Person in the Target. To do this, we’ll make use of the Tool Palette at the top of the screen:


The tool palette is composed of two rows of tabs that organize XSLT instructions, functions, extensions, call-outs, and other drag & drop components by category. The instruction we’re looking for is called for-each and it can be found under the tabs XSLT StructuresFlow Control:


Drag the for-each instruction onto the People element from the Target in the mapping panel:


This will create a for-each XSLT instruction as a child of the Target People element.

The for-each instruction is pretty simple; it iterates over each Node returned from the expression in its “select” attribute and executes each of its child instructions or elements against that node. We’ll want to iterate over each Person in the Source, so drag Person from the Source panel onto the for-each @select attribute:


You should see the @select attribute change from the ? value to a path for the Person element:


The for-each instruction will now execute for each Person in the Source.


Creating a Person in the Target

The next action we’ll want to take is to create a Person in the Target. Drag Person from the Target panel onto the for-each element:


Map the various child elements and attributes of Person from the Target onto the newly created Person in the center panel of the data mapper:


Mapping the Corresponding Values

Once again, we’ll map the corresponding values in the Source Person onto the Person in the center panel. There’s one conceptual difference, however. This time, each expression used to populate the elements with values is relative to the for-each’s current node. Because for-each“evaluates for each Person in the Source, that means that each expression is evaluated against that Person. This means that the third iteration’s expressions will be evaluated against the third Person. The Data Mapper is automatically aware of context, meaning you do not need to do anything but drag-and-drop to make use of these concepts. Map the Source Person onto the Person in the center:


In order to test this, go to the Testing tab…

…and click the green arrow.


You should end up with 100 people in the center panel.


Compare the results with the Source. In this case, they should be identical. If they are, you’re done! Great job.


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