question

sushilauradkar avatar image
0 Votes"
sushilauradkar asked leafsomegroup-8203 Suspended commented

BizTalk Server Looping Functoid - Not Working as expected

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>

biztalk-server
msdn.png (42.2 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Dear Member,

Thank you for posting your question on Q&A site.

If you are still having an issue then did you tried the XSLT option?

Regards,
Kamlesh Kumar

0 Votes 0 ·
ColinDijkgraaf avatar image
1 Vote"
ColinDijkgraaf answered ColinDijkgraaf edited

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.



qa246211.png (32.1 KiB)
qa246211b.png (25.7 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

NonkiTakahashi avatar image
0 Votes"
NonkiTakahashi answered leafsomegroup-8203 Suspended commented

Hi @sushilauradkar, 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.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @NonkiTakahashi, BizTalk tag is created and now user can choose 'Biztalk-server-all' for biztalk related questions. if you see any questions tagged wrongly, kindly retag them.

1 Vote 1 ·