Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Mapping – Inner loop
- This topic has 1 reply, 1 voice, and was last updated 8 years, 3 months ago by
community-content.
-
AuthorPosts
-
-
December 23, 2008 at 9:47 AM #21436
Hello Gurus,
I looked in the forums about my particular situation and didn’t see anything that was relevant. I hope this is not a duplicate scenario.
I’m having a difficult time getting a looping structure to work properly in the Biztalk Mapper. I can only get the parent or the child elements to loop, but never both of them. Here is a simplified version of my incoming schema.
<Case><Student>
<Name />
<Dob />
<OtherPersonalDetails />
<Guardian>
<Name />
<Dob />
<OtherPersonalDetails /></Guardian>
<Parent>
<Name />
<Dob />
<OtherPersonalDetails /></Parent>
</Student>
<Tutor>
same structure as above
</Tutor></Case>
My destination schema is much simpler.
<Person>
<name />
<dob />
<otherdetails />
<Person>
I need to somehow loop over Student, Student’s Guardian (if it exists), Student’s Parent (if it exists), Tutor, tutor’s Guardian (if it exists), and the tutor’s parent (if it exists). Afterall, they are all simply <people> in my destination. When I try to set up the loop, I am getting not enough <person> elements and duplicated data in the field. I can see why that’s happening, I just don’t know how to fix it. Any help would be greatly appreciated.
One other thing, I was able to accomplish the above using the table looping fuctoid and table extractor. My real schema is much more complicated than the above so likely if I really build with the table extractor I would have many rows and many more columns. I would really like to avoid that solution unless there is a more intuitive way to configure the table using something other than the Biztalk “Configure Table Looping Grid”.
I’ve also thought of another solution, that I doubt would fall into the “Best Practices” category. That is to do the parent looping in one transform and then the child looping in another transform and then join the two messages.
Thank you for any insight you can provide.
Regards,
Bart
-
January 19, 2009 at 5:22 PM #21529
Just found a solution to the problem I was having, in case any others have a similar problem.
You need to set up a conditional loop to get the information. To accomplish this, use the looping functoid over the element you are getting the information from. In the example above, loop over the name element because if there is not a name, then really the person doesn’t exist. You could on the other hand have a name without a DoB, that’s why you loop over name. So now you should have a loop over the name working properly with the correct number of names in the source. The tricky part is getting the other details and dob.
To accomplish this part, you need to set up a condition. So, if name exists, then map the information from dob and OtherPersonalDetails. Pull the “logical existence funtoid” and place on the grid. Draw a line from the name record to the existance functoid. Now drag as many “value mapping” functoids as you need. Lets say there are 2 personal details: eye color and hair color. And you need dob, so you will need 3 value mapping functoids. Place these funcoids just to the right of your logical existence. Draw a line from the logical existence to each of the value mapping funcoids. Next, draw the line from your element in the source to the corresponding value mapping functoid. Finally, draw your lines from the value mapping functoids to your destination.
I hope this helps. If there are any questions, please post a reply. I should be notified and I’ll see if I can help in any way.
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.