Geeks With Blogs
That BizTalk guy from India Benny Mathew

Here’s a cool mapping tip I found on Vijendra’s blog.

While mapping an element from the source schema to the target schema, it is possible to copy either the value contained within the element or the element name itself.

You achieve this by setting the Source Links property of the link connecting the elements as shown below.

In the above figure above the value mapped to the target element will be “CustomerName”.

The values that can be set are:
1. Copy text value – which is the default that copies the content of the element
2. Copy name – copies the name of the source node instead of its value
3. Copy text and subcontent value – concatenates the value of all child nodes

Now you might be wondering what is this 3rd value (Copy text and subcontent value) that can be set…

This is used if you want to concatenate all the child element values of the source node into a single element in the target as shown below.

Here is an example:

Input Message
<ns0:Root xmlns:ns0="http://MapTest.SourceSchema">
  <Record>
    <FirstName>FirstName_0</FirstName>
    <LastName>LastName_0</LastName>
    <Street>Street_0</Street>
    <City>City_0</City>
  </Record>
  <Record>
    <FirstName>FirstName_1</FirstName>
    <LastName>LastName_1</LastName>
    <Street>Street_1</Street>
    <City>City_1</City>
  </Record>
</ns0:Root>

Output Message
<ns0:Root xmlns:ns0="http://MapTest.DestinationSchema">
  <Record>
    <Data>FirstName_0LastName_0Street_0City_0</Data>
  </Record>
  <Record>
    <Data>FirstName_1LastName_1Street_1City_1</Data>
  </Record>
</ns0:Root>


Now here is another interesting mapping

The mapping above transforms the elements in the source schema into a key-value pair as shown below.

Each element node from the source schema links to the two elements in the target schema, one link copies the node name and the other copies the node value.

Input Message
<ns0:Root xmlns:ns0="http://MapTest.SourceSchema">
  <Record>
    <FirstName>FirstName_0</FirstName>
    <LastName>LastName_0</LastName>
    <Street>Street_0</Street>
    <City>City_0</City>
  </Record>
</ns0:Root>

Output Message
<ns0:Root xmlns:ns0="http://MapTest.KeyValuePair">
  <Record>
    <FieldName>FirstName</FieldName>
    <FieldValue>FirstName_0</FieldValue>
  </Record>
  <Record>
    <FieldName>LastName</FieldName>
    <FieldValue>LastName_0</FieldValue>
  </Record>
  <Record>
    <FieldName>Street</FieldName>
    <FieldValue>Street_0</FieldValue>
  </Record>
  <Record>
    <FieldName>City</FieldName>
    <FieldValue>City_0</FieldValue>
  </Record>
</ns0:Root>


 Regards
Benny Mathew
Seamless Integration Solutions
BizTalk Consulting, Development, Training
http://www.seamless.in

Posted on Monday, February 6, 2006 9:28 PM | Back to top

Copyright © Benny Mathew | Powered by: GeeksWithBlogs.net