BizTalk Document Mapping – Value Mapping Functoid and Value Mapping (Flattening) Functoid

  • Sandro Pereira
  • Jul 20, 2009
  • 4 min read

The Advanced Functoids category in the BizTalk Mapper contains two tools that look almost identical: Value Mapping and Value Mapping (Flattening). While they both require a Boolean input and a value input, using the wrong one can lead to broken maps or unexpected empty tags.

If you want to map a specific field based on a condition, then the Value Mapping functoid and the Value Mapping (Flattening) Functoid are the two forms available to do that. Both functoids will cause a new record or element to be created in the destination for every record or element in the source based on the logical condition evaluation that returns true or false.

📝 One-Minute Brief

Choosing between the Value Mapping and Value Mapping (Flattening) functoids is a common hurdle in BizTalk mapping. This post clarifies their distinct roles: use Value Mapping for conditional data movement between parallel structures, and Value Mapping (Flattening) when you need to convert a nested, repeating source structure into a single, flat destination record. Understanding this distinction is the key to avoiding empty tags and ensuring your output matches the target schema perfectly.

Both require 2 input parameters:

  • A Boolean value;
  • The node to be mapped;

If the Boolean is true, the value of the incoming field will be mapped, otherwise not.

Value Mapping Functoid

The Value Mapping functoid returns the value of its second parameter if its first parameter is true. A common use of the functoid is to change the attributes of a field into the attributes of a record

Sample:

InputOutput
<Root>
<Record>
<Field Name=”Param1″ Value=”1000″/>
<Field Name=”Param2″ Value=”2000″/>
<Field Name=”Param3″ Value=”3000″/>
</Record>
<Record>
<Field Name=”Param1″ Value=”1001″/>
<Field Name=”Param2″ Value=”2002″/>
<Field Name=”Param3″ Value=”3003″/>
</Record>
<Record>
<Field Name=”Param1″ Value=”1100″/>
<Field Name=”Param2″ Value=”2200″/>
<Field Name=”Param3″ Value=”3300″/>
</Record>
</Root>
<Root>
<Record Param1=”1000″ />
<Record Param2=”2000″ />
<Record Param3=”3000″ />
<Record Param1=”1001″ />
<Record Param2=”2002″ />
<Record Param3=”3003″ />
<Record Param1=”1100″ />
<Record Param2=”2200″ />
<Record Param3=”3300″ />
</Root>

Value Mapping (Flattening) Functoid

The Value Mapping (Flattening) functoid returns the value of its second parameter if its first parameter is true. The Value Mapping (Flattening) functoid enables you to flatten a portion of an input instance message by converting multiple records into a single record

Sample:

InputOutput
<Root>
<Record>
<Field Name=”Param1″ Value=”1000″/>
<Field Name=”Param2″ Value=”2000″/>
<Field Name=”Param3″ Value=”3000″/>
</Record>
<Record>
<Field Name=”Param1″ Value=”1001″/>
<Field Name=”Param2″ Value=”2002″/>
<Field Name=”Param3″ Value=”3003″/>
</Record>
<Record>
<Field Name=”Param1″ Value=”1100″/>
<Field Name=”Param2″ Value=”2200″/>
<Field Name=”Param3″ Value=”3300″/>
</Record>
</Root>
 

 

<Root>
<Record Param1=”1000″ Param2=”2000″ Param3=”3000″ />
<Record Param1=”1001″ Param2=”2002″ Param3=”3003″ />
<Record Param1=”1100″ Param2=”2200″ Param3=”3300″ />
</Root>

 

Difference between the two functoids

The difference between these two functoid is how they are mapped to the destination.

  • If the value of the incoming field cannot be mapped, then Value Mapping Functoid will create an empty destination node (<node />);
  • While Value Mapping Functoid (Flattening) will not create an empty node.

The default behavior of the Value Mapping Functoid can be changed using other functoid and scripting.

Hope you find this helpful! If you liked the content or found it useful and would like to support me in writing more, consider buying (or helping to buy) a Star Wars Lego set for my son. 

Thanks for Buying me a coffe
Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

1 thought on “BizTalk Document Mapping – Value Mapping Functoid and Value Mapping (Flattening) Functoid”

  1. Nice, Sandro… I must say I’m a big fan of your BizTalk posts… I like how you put things in a simple manner, easy enough to understand…

Leave a Reply

Your email address will not be published. Required fields are marked *

The Ultimate Cloud
Management Platform for Azure

Supercharge your Azure Cost Saving

Learn More
Turbo360 Widget

Back to Top