locked
Map optional hardcoded record RRS feed

  • Question

  • Hi,

    I have the scenario that i map a bunch of party record with about 3-4 elements. 

    Now i have a special customer which needs a new party record in the destination file. This record should be hardcoded in Biztalk because it doesnt exist in the source info yet.

    So i have a map fragment below. It loops through all the PartAddress records and write them to the destination Party record. 

    The new spec is also in this map but isnt working correct. If volgnummer is 5 (which means this is the new customer) then the equal functoid is true and should create a new Party record and fill with 3 value mapping functoids. 

    The result that i expect is:

    <partys>
    	<party>
    		<qual>SE</qual>
    		<gln>1235456</gln>
    		<vatnum>5555</vatnum>
    		<name>Default company</name>
    	</party>
    	<party>
    		<qual>DP</qual>
    		<gln>123456</gln>
    		<vatnum>111</vatnum>
    		<name>New customer</name>
    	</party>
    </partys>

    But the result i get is:

    <partys>
    	<party>
    		<qual>SE</qual>
    		<qual>DP</qual>
    		<gln>1235456</gln>
    		<gln>123456</gln>
    		<name>Default company</name>
    		<name>New customer</name>
    	</party>
    </partys>

    So it doesn't create a new record, it just add new elements in the existing record.

    How can i fix this, i prefer to use Biztalk functoids instead of XSLT fragments.

    Friday, July 31, 2015 8:06 AM

Answers

  • Sorry, what you're asking for, creating entirely new records, is not possible with just Functoids.

    You will have to use a Scripting Functoid with Xslt.

    • Marked as answer by Angie Xu Monday, August 10, 2015 2:04 AM
    Friday, July 31, 2015 12:23 PM
    Moderator
  • Hi Ronald,

    You have to add a scripting functiod and in the scripting functiod call "Inline XSLT Call Template". In the scripting functiod, create an xslt where in you can have 2 sections, one would be hard coded and other one would be fetching the value from source.

    Example:

    <empDetails>
     
    <empname><xsl:text>abcd</xsl:text></empName>
     
    <empID><xsl:text>1234</xsl:text></empID>
     
    </empDetails>// this record will always have the hard coded value
     
    <empDetails>
     
    <empname><xsl:value-of select ="empName/text()"/></empName>
     
    <empID><xsl:value-of select ="empID/text()"/></empID>
     
    </empDetails>// fetching the values from the source
    


    Please mark as answer or vote as helpful if my reply does

    • Marked as answer by Angie Xu Monday, August 10, 2015 2:04 AM
    Friday, July 31, 2015 12:51 PM
    Moderator

All replies

  • Well for a new record  you will have a put it in xslt, I dont think it can be done by using just the functoids.

    Or, You can just fake one more input to your looping fucntiod and take decisions to map the hard coded values.


    Regards &lt;br/&gt; When you see answers and helpful posts,&lt;br/&gt; please click Vote As Helpful, Propose As Answer, and/or Mark As Answer


    Friday, July 31, 2015 8:25 AM
    Answerer
  • Sorry, what you're asking for, creating entirely new records, is not possible with just Functoids.

    You will have to use a Scripting Functoid with Xslt.

    • Marked as answer by Angie Xu Monday, August 10, 2015 2:04 AM
    Friday, July 31, 2015 12:23 PM
    Moderator
  • Hi Ronald,

    You have to add a scripting functiod and in the scripting functiod call "Inline XSLT Call Template". In the scripting functiod, create an xslt where in you can have 2 sections, one would be hard coded and other one would be fetching the value from source.

    Example:

    <empDetails>
     
    <empname><xsl:text>abcd</xsl:text></empName>
     
    <empID><xsl:text>1234</xsl:text></empID>
     
    </empDetails>// this record will always have the hard coded value
     
    <empDetails>
     
    <empname><xsl:value-of select ="empName/text()"/></empName>
     
    <empID><xsl:value-of select ="empID/text()"/></empID>
     
    </empDetails>// fetching the values from the source
    


    Please mark as answer or vote as helpful if my reply does

    • Marked as answer by Angie Xu Monday, August 10, 2015 2:04 AM
    Friday, July 31, 2015 12:51 PM
    Moderator
  • Hi Ronald,

    John and Rechit are correct you have to use xslt to accomplish this task.

    Regards,

    Sharad

    Friday, July 31, 2015 1:34 PM
  • Hi Ronald ,

    you can make use of a scripting functoid and specify inline xslt to achieve the same. with inline xslt you can easily create a repeating structure of the destination node.

    You can take reference from earlier MSDN post

    https://social.msdn.microsoft.com/Forums/en-US/9208a034-4e61-4f0f-97bd-27528d6de4fb/how-to-map-single-to-multiple-record-in-biztalk-map?forum=biztalkgeneral

    https://social.msdn.microsoft.com/Forums/en-US/c3eaba8d-5979-4db4-8ce4-6a3e47dd6318/biztalk-map-single-record-to-multiple-records?forum=biztalkgeneral

    Thanks

    Abhishek

    Friday, July 31, 2015 4:58 PM