Creating Nodes from Flat Data in BizTalk 2004 Maps

It can sometimes be challenging when mapping schemas in BizTalk 2004.  One common problem is when the inbound document has one record and the source creates multiple records based on the data inside your single record.

The root problem arises because you have nothing to loop around in the inbound document and need to create multiple nodes on the output.

How can this be handled in the mapper?

Two ways: Functoids or XSLT Template

BizTalk 2004 introduces a new Functoid just for this situation.  It is called the Table Looping Functoid.  It is accompanied by the Table Looping Functoid Data Extractor.  The table looping functoid will take a flat row of data and produce multiple nodes of data on the destination schema.

CRITICAL: The key to working with the table looping functoid is to label your links.  This can be done by selecting the link and going to Properties.  Under General you can set the label.  This will show up inside the Input Parameters section of your functoids as the label name.

An alternative to the Table Looping Functoid is to use a custom XSLT Template call inside a scripting functoid. This requires error prone XSLT coding.

In both cases, the number of input parameters must be known ahead of time.

I have put together a sample showing both the Table Looping Functoid and XSLT Template solutions.

DOWLOAD:

In addition to Node Creation, this sample includes a map called Map_RowSplit.  This sample takes an order item and evaluates the node for “Y” (meaning the item is gift wrapped).  If it is “Y” two line items are created on the output rather then one.  This uses the and XSLT element.

This article is part of the GWB Archives. Original Author: Stephen W. Thomas

New on Geeks with Blogs

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.