locked
BizTalk Map - Looping Functoid more than 100 parameters RRS feed

  • Question

  • Hi ! In my Biztalk map, for one of the mapping logic I have more than 100 input parameters to be mapped in a Looping functoid which seems to be not possible. Any other alternate way to do this

    Tuesday, August 2, 2016 9:38 AM

Answers

  • Hi,

    Like you said, With reference to the below thread, the mapping approach is very difficult when a number of fields increases.

    Like you mentioned Looping is giving a problem, etc.

    https://social.technet.microsoft.com/Forums/en-US/7fd8a4a3-8ab0-49f8-9498-7b2e2fea4d37/biztalk-map-best-way-for-this-requirement?forum=biztalkgeneral

    To solve this problem I recommend you to use XSLT.

    - Here you can increase the number of for each loop with proper XPath for the record you want to map.

    - I have added If condition to avoid few nodes in mapping (sample you can extend how you want).

    - You can check specific node or field if you have any custom logic to implement using $NodeName = 'ABC'.

    - Use this template in Inline XSLT Call Template, when the size of you XSLT grows you Import from file option from a text file.

      <xsl:template name="SMS.XSLT.KeyValuePair.Mapping">
        <CRMSystem>
          <TransHeader>
            <Sender>SMS</Sender>
            <Organization>Company</Organization>
          </TransHeader>
          <Transactions>
            <Transaction>
              <TransactionType>Cash</TransactionType>
              <xsl:for-each select="/*[local-name()='TransDetails' and namespace-uri()='http://BT1.Courier']/*[local-name()='A102_CourierDispatched' and namespace-uri()='http://SMS.Schema4']/*[local-name()='Item' and namespace-uri()='']/*">
                <xsl:variable name="NodeName" select="local-name()"/>
                <xsl:variable name="NodeValue" select="."/>
                <xsl:if test="$NodeName!='No1' and $NodeName!='No2'">
                  <xsl:if test="$NodeValue">
                    <Record>
                      <Key>
                        <xsl:value-of select="$NodeName"/>
                      </Key>
                      <Value>
                        <xsl:value-of select="$NodeValue"/>
                      </Value>
                    </Record>
                  </xsl:if>
                </xsl:if>
              </xsl:for-each>
            </Transaction>
          </Transactions>
        </CRMSystem>
      </xsl:template>



    Try and let us know if you face any issues.

    Thanks, SMSVikasK


    Tuesday, August 2, 2016 2:45 PM
    Answerer
  • Hi,

    Sample input, Output snap for reference.

    Thanks, SMSVikasK

    Tuesday, August 2, 2016 3:15 PM
    Answerer
  • Hi,

    Another alternative using BizTalk mapping to fulfill your requirement.

    - for every record to single looping shown below.

    - 1- link to key with lin name  link properties

    - 1 link to value Copytext value link properties

    repeat like shown in the image.



    Thanks, Vikas K



    Wednesday, August 3, 2016 1:19 PM
    Answerer

All replies

  • Hi

    Drag a new looping functoid and map the remaining source/destination links in the new one. The existing looping functoid that has exceeded this limit will contain the earlier 100 input links - no need to modify this earlier looping functoid/any of the existing links.


    Thanks Arindam



    Tuesday, August 2, 2016 9:43 AM
    Moderator
  • Hi btsadmin,

    Use multiple looping functoid in tandem with each other connected to the same destination node.

    Another way is using Foreach loop in xslt.

    Regards,


    Mandar Dharmadhikari

    Tuesday, August 2, 2016 10:14 AM
    Moderator
  • Thanks Arindam and Mandar for your reply. Actually If i try to add another looping functoid, it is not working as expected and no output is coming. actually the I have implemented the map based on this for a Key-Value pattern destination schema

    https://social.technet.microsoft.com/Forums/en-US/7fd8a4a3-8ab0-49f8-9498-7b2e2fea4d37/biztalk-map-best-way-for-this-requirement?forum=biztalkgeneral

    I have used the functoid logic from the above, totally i have around 250 elements to be mapped to a looping functoid. But When I tried using the 2nd looping functoid, i am getting blank response inplace of key and value. But if i tried to add that to the first looping functoid by removing some links from there. Its working. Any other way to solve this

    Tuesday, August 2, 2016 11:13 AM
  • Hi

    Can you share a screenshot of your current map? Are there other looping functoids in the map other than the one that has 100 source links?

    Maybe you can create a new map and just do a test with two looping functoids - first looping functoid will be connected to the first source element, and the 2nd looping functoid will be connected to the second source element. If you can get this to work, you can extend this by linking 100 source elements in the first looping functoid, next 100 in the 2nd looping functoid and so on..


    Thanks Arindam



    Tuesday, August 2, 2016 12:24 PM
    Moderator
  • KVP?...let me guess...CRM...

    If it is CRM, and it's really the case for any KVP situation, you don't need to use a Looping Functoid.

    Why do you think you need one? 

    Tuesday, August 2, 2016 12:30 PM
    Moderator
  • Hi Arindham,

    I tried testing in a new map with 2 looping functoids, its not working.

    Please find the below screenshot, a sample of how my map looks.

    The looping functoid which is highlighted is having issue.

    In the real time implementation, I have around 15 nodes in the source and the total no of element count is around 220, till 99 elements it is working after that it is not working.

    Is it not possible to fix in functoids ? or I should use xslt here ?

    Tuesday, August 2, 2016 12:52 PM
  • Hi John, Why not looping functoid. Any other better suggestion.

    Yes it is CRM

    Tuesday, August 2, 2016 12:53 PM
  • Hi John,

    Yes, it is CRM

    Why not looping functoid, any better suggestion ?

    Tuesday, August 2, 2016 12:53 PM
  • Hi

    Couple of things-

    1. The looping functoid connected to Transaction element(in destination) should be connected to Item element in the source schema. (this is based on your earlier thread details)

    2. Use a separate looping functoid for each child element of TransDetails - that way each looping functoid will only have 5 source links - and you will never run into this issue.

    So, first looping functoid will be connected to the ItemID, From fields, etc. under A101_CourierReceived record. The 2nd looping functoid will be connected to the ItemID, From fields, etc. under A102_CourierDispatched record, and so on. So, you will have 15 looping functoids(instead of the single one now) for each source record.

    On the destination schema side, each of the looping functoid output link will be connected to the same Record element.

    Try/test this with 2 looping functoids in a test map for the above two records(in bold), and then you can do the same in your original map.


    Thanks Arindam





    Tuesday, August 2, 2016 1:01 PM
    Moderator
  • Is that target Schema an actual CRM Schema or is it a internal canonical?
    Tuesday, August 2, 2016 1:26 PM
    Moderator
  • Hi John,

    It is Internal canonical

    Tuesday, August 2, 2016 2:15 PM
  • Hi,

    Like you said, With reference to the below thread, the mapping approach is very difficult when a number of fields increases.

    Like you mentioned Looping is giving a problem, etc.

    https://social.technet.microsoft.com/Forums/en-US/7fd8a4a3-8ab0-49f8-9498-7b2e2fea4d37/biztalk-map-best-way-for-this-requirement?forum=biztalkgeneral

    To solve this problem I recommend you to use XSLT.

    - Here you can increase the number of for each loop with proper XPath for the record you want to map.

    - I have added If condition to avoid few nodes in mapping (sample you can extend how you want).

    - You can check specific node or field if you have any custom logic to implement using $NodeName = 'ABC'.

    - Use this template in Inline XSLT Call Template, when the size of you XSLT grows you Import from file option from a text file.

      <xsl:template name="SMS.XSLT.KeyValuePair.Mapping">
        <CRMSystem>
          <TransHeader>
            <Sender>SMS</Sender>
            <Organization>Company</Organization>
          </TransHeader>
          <Transactions>
            <Transaction>
              <TransactionType>Cash</TransactionType>
              <xsl:for-each select="/*[local-name()='TransDetails' and namespace-uri()='http://BT1.Courier']/*[local-name()='A102_CourierDispatched' and namespace-uri()='http://SMS.Schema4']/*[local-name()='Item' and namespace-uri()='']/*">
                <xsl:variable name="NodeName" select="local-name()"/>
                <xsl:variable name="NodeValue" select="."/>
                <xsl:if test="$NodeName!='No1' and $NodeName!='No2'">
                  <xsl:if test="$NodeValue">
                    <Record>
                      <Key>
                        <xsl:value-of select="$NodeName"/>
                      </Key>
                      <Value>
                        <xsl:value-of select="$NodeValue"/>
                      </Value>
                    </Record>
                  </xsl:if>
                </xsl:if>
              </xsl:for-each>
            </Transaction>
          </Transactions>
        </CRMSystem>
      </xsl:template>



    Try and let us know if you face any issues.

    Thanks, SMSVikasK


    Tuesday, August 2, 2016 2:45 PM
    Answerer
  • Hi,

    Sample input, Output snap for reference.

    Thanks, SMSVikasK

    Tuesday, August 2, 2016 3:15 PM
    Answerer
  • Still its not working Arindam ! the same behaviour. only the first looping functoid works and the second one is not working .

    By using the XSLT it works Vikas, thank you !

    Tuesday, August 2, 2016 3:17 PM
  • Hi 

    Can you share the input message structure/sample XML input you are using to test?


    Thanks Arindam

    Tuesday, August 2, 2016 3:19 PM
    Moderator
  • Hi,

    Another alternative using BizTalk mapping to fulfill your requirement.

    - for every record to single looping shown below.

    - 1- link to key with lin name  link properties

    - 1 link to value Copytext value link properties

    repeat like shown in the image.



    Thanks, Vikas K



    Wednesday, August 3, 2016 1:19 PM
    Answerer