From single node to repeating nodes using BizTalk Mapper

Oguzhan Yigit
Published by Oguzhan
Category : BizTalk
23/06/2017

Switching from a single node to a repeating nodes structure is a case I have frequently answered with BizTalk. BizTalk and his mapping toolbox allows to get these transformations easily . Usually, you will need to do that when you’ll have to get a target message with a key value pair structure.

This post illustrates how BizTalk maps, and more precisely Table looping and Table Extractor functoids are helpful to achieve it. All the sample here have been realized with Microsoft BizTalk 2013 R2 and Visual Studio 2013.

Below, you’ll find the two schemas we will work with all along this post. The BizTalk map we are making will transform a message from the schema on the left to the schema on the right.

source schematarget schéma

Let’s have a look to the target schema and see that the node “Parameters” is a repeating node.

Unbounded node property

Ok, we now focusing on our map. First of all, I have selected the source and the target schemas and dropped the Table Looping functoid from the Toolbox into the BizTalk mapper.

Biztalk map Table looping functoid

The Table Looping Functoid takes the first two parameters as defined below :

  1. Execution scope : will define when the functoid transformation will be executed and which is the related scope. It’s nothing more than the node we want to get as key value pair
  2. Number of columns in the target table : here we should understand what the Table Looping will do with our data. It will build a two dimensioned table to store data we want to manipulate. So, that second parameters will define the numbers of columns of our data table.

After these two parameters, all parameters given to functoid will be used to populate the data table.

So, to fill the configuration properties of the Table Looping functoid, we are using the “Order” node from source schema to define the scope and we type the value “2” in the second input parameters as we want a table data with 2 columns. The first column will contain the key of our data and the second the value of the source node.

 

The first step of the functoid configuration is :

  1. Link the « Order » node of source schema to the Table Looping Functoid
  2. Set the value « 2 » for the second input parameter in configuration panel, as we want our Table Looping functoid configured with a 2 columns data table
  3. Set « OrderDate » for the third input parameter (here we can choose anything we need in the target message, that will be the key of our target node)
  4. Link the « Date » node to our Table Looping functoid Table Looping : this will be used to set the “Value” node in the target schema

 

Once all of these steps are done, our configuration panel should look like this :

Configure Table looping functoid

For now, you should understand that the Biztalk mapper will handle only the first node of our source schema. To finialize Table Looping configuration, we just need to repeat step 3 and 4 for all nodes of our source schema. For the links or the labes manually given as input parameters to the Table Looping functoid, the ordering doesn’t really matter. Just be sure to make it easily readable for you.

Link Table looping functoid

As we can see, I have linked all the source properties to the Table Looping functoid. Of course, I also have set all the keys for the target schema. Before linking data to the target schema, we have to define our data table. Indeed, we have linked the source data to the functoid, but we have to say to the Table Looping functoid how it has to organize the data inside the data table. To achieve that, we just choose the data in second tab of the configuration panel.

Configure Table looping functoid

It’s now easy to understand that the first column of our table contains the key where the second contains the value.

Next step is to extract these data and send them to the target message. Just add 2 “Table Extractor” functoid to the map.

Inside our Biztalk map, each Table Extractor functoid must have 2 parameters defined :

  • The first one is the link from the Table Looping functoid : well, it’s just to say the extractor where to find the data table. So just link the Table functoid to the Table Extractor functoid
  • The second one is used to set the column index: Table Extractor will select the data at that column index. Note that first index is “1”.

Here is my first Table Extractor functoid configured :

Biztalk map Table Extractor functoid

And then the second one :

Configure Table Extractor functoid

That’s it! Everything is ready to test. Using the message below:

Biztalk map input message

give us the following result:

Biztalk map output message