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

If you want to map a specific field based on a condition, then Value Mapping functoid and 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.

And Both require 2 inputs 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.

This default behavior of Value Mapping Functoid can be changed with the help of other functoid and scripting.

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 *

turbo360

Back to Top