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:
Input | Output |
<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:
Input | Output |
<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>
|
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.
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…