Wednesday, April 6, 2016

For-each usage with Looping, Conditional and Value Mapping Functoids in BizTalk

In one requirement client requested to develop destination schema having specific output format.

Problem : xsl:for-each statment to be put at the parent field of destination schema while using the Looping, Conditional and Value Mapping Functoids

Solution : When you use a Looping, Conditional functoid, or a Value Mapping functoid, an xsl:for-each statement is generated in the compiled map. If the child field of the destination schema has unbounded maximum occurrences, the xsl:for-each statement is put at the child field. If the child field does not have unbounded maximum occurrences, the xsl:for-each statement is put at the parent field of the child field.

However, because the location of the xsl:for-each statement affects the map result, you may want the xsl:for-each statement to be put at the child field of the destination schema, regardless of whether the maximum occurrence of the child field is set to 1.

You can control the placement of the xsl:for-each statement by modifying the value of the TreatElementsAsRecords attribute in the map (.btm) file

     Syntax : <mapsource TreatElementsAsRecords="Yes" ></mapsource>


When this attribute is set to Yes, the xsl:for-each statement is put at the child field of the destination schema, regardless of whether the maximum occurrence of the child field is set to 1.

Hope this Helps!!!

No comments:

Post a Comment