BizTalk Server Looping Functoid - Not Working as expected

sushil 41 Reputation points
2021-01-26T20:34:19.047+00:00

HI,

I have a map as follows

60599-msdn.png

Here in the above map, I am checking if the ELIGIBLE is equal to "true" then i am passing the value amount and name from source to destination.

Sample Input

<ns0:Root xmlns:ns0="http://biztalktest">
<UniqueNumber>167</UniqueNumber>
<TotalCost>2000</TotalCost>
<Packages>
<Package>
<Child1>
<GrandChild>
<amount>10</amount>
<eligible>true</eligible>
<name>Joe</name>
</GrandChild>
<GrandChild>
<amount>20</amount>
<eligible>false</eligible>
<name>Don</name>
</GrandChild>
<GrandChild>
<amount>20</amount>
<eligible>true</eligible>
<name>Pie</name>
</GrandChild>
</Child1>
</Package>
<Package>
<Child1>
<GrandChild>
<amount>30</amount>
<eligible>false</eligible>
<name>John</name>
</GrandChild>
<GrandChild>
<amount>40</amount>
<eligible>true</eligible>
<name>Levis</name>
</GrandChild>
<GrandChild>
<amount>30</amount>
<eligible>false</eligible>
<name>Hami</name>
</GrandChild>
</Child1>
</Package>
</Packages>
</ns0:Root>

Incorrect Output

<?xml version="1.0"?>
<ns0:Response xmlns:ns0="http://Biztalk>
<Uniquenumber>167</Uniquenumber>
<totalamount>2000</totalamount>
<add-ons>
<add-on>
<name>Joe</name>
<amount>10</amount>
</add-on>
<add-on/>
</add-ons>
</ns0:Response>

Output Expected
<?xml version="1.0"?>
<ns0:Response xmlns:ns0="http://Biztalk>
<Uniquenumber>167</Uniquenumber>
<totalamount>2000</totalamount>
<add-ons>
<add-on>
<name>Joe</name>
<amount>10</amount>
</add-on>
<add-on>
<name>Pie</name>
<amount>20</amount>
</add-on>
<add-on>
<name>Levis</name>
<amount>40</amount>
</add-on>
</add-ons>
</ns0:Response>

Microsoft BizTalk Server
Microsoft BizTalk Server
A family of Microsoft server products that support large-scale implementation management of enterprise application integration processes.
349 questions
{count} votes

Accepted answer
  1. Colin Dijkgraaf 1,346 Reputation points
    2021-03-10T20:32:52.067+00:00

    What you need is like this where you allow the BizTalk mapper to work out the looping itself
    Note: You also don't need the Value Mapping functoid as it is easier just to suppress the whole add-on from the Equal functoid.

    76415-qa246211.png

    Output

    <ns0:Response xmlns:ns0="http://Biztalk">
    <Uniquenumber>167</Uniquenumber>
    <totalamount>2000</totalamount>
    <add-ons>
    <add-on>
    <name>Joe</name>
    <amount>10</amount>
    </add-on>
    <add-on>
    <name>Pie</name>
    <amount>20</amount>
    </add-on>
    <add-on>
    <name>Levis</name>
    <amount>40</amount>
    </add-on>
    </add-ons>
    </ns0:Response>

    If you want to see what looping the map is going to do, look in the Error List after doing a test, and double click on "Double-click here to show/hide compiler links" and then it will look like

    76416-qa246211b.png

    The looping functoid is useful where it isn't a repeating element, or there are multiple independent repeating elements that need to be looped over to go to a single repeating element, in which case you link all of the source nodes to the same looping functoid, and link that the the destination.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Nonki Takahashi 676 Reputation points
    2021-01-27T11:58:55.53+00:00

    Hi @sushil , tag small-basic-general is for Microsoft Small Basic program language. So this tag is not suitalbe for your BizTalk question. There are no BizTalk tags yet. Current best tag for your question may be not-supported. Thanks.