none
Looping problems in a d96a schema (NADLoop1). RRS feed

  • Question

  • Dear BizTalk Gurus,

    I am beginner with BizTalk and I am doing a lot of struggling and I wonder If could get some help.

    I am trying to map a Inhouse XML to a d96a Invoice edi message. My problem seems to be common when searching through the different forums but no one posts a solution to the problem.

    My problem is in the NADLoop1 where I should define the buyer and seller (NAD+BY and NAD+SU), when I try to loop around NADLoop1, it says NODE CAN T REPEAT. (yes, I have tried to change the maxOccurres -value but then the schema will not compile).

     

    Structure

    Customer
      CustomerName
      CustomerAddress
      CustomerZip
       ….
    Customer

    Seller
      SellerName
      SellerAdress
      SellerZip
      ….
    Seller

    MoreinformationSeller
       SellerAccountInformation
       SellerVAT
      
    MoreinformationSeller

    I created one loop for Customer and a second loop for Seller/ MoreinformationSeller, but it sems that mapping will try to print everything at one line which will give the following result:

    NAD+BY*SU+SE11223344101::92++Transport i Sverige AB,+Box 5066+101 01++SE+SE'

     

    My questions are the following:

    1, Is looping the right approach?
    2, Are there any other NADLoop´s that I could use? (I did find NADLoop2, but then I got stuck on some other issues).
    3, Could some send me an example?


    Kind Regards,

    Thomas E

    Tuesday, April 28, 2009 3:48 PM

Answers

  • Thomas,

    That information is in the book.  Essentially, the engine moves down the target schema, node by node.  Children are executed before parents, except:

          Output control such as looping functoids or logical functoids that control the output of the node are executed first.

    This means global variables, such as counters, that are attached to the parent will not be instantiated or modified until the children of the parent have been processed.

    That's a small percentage of the whole process of course.  You can see the order of processing by validating your map and then examining the XSLT to see the logic.  This is also covered in the book with examples of how to read the XSLT.  You'll be surprised at how the engine interprets some of the links.


    Jim -- Pro Mapping in BizTalk 2009, Apress Books, March 23, 2009
    Thursday, April 30, 2009 2:50 PM

All replies

  • Thomas,

    I can't visualize your exact problem as explained.  Email me or call me if you want and I'll see if I can help -- if so we can post the results here.  jim@sspsi.com 919-548-6521.

    Since you're new to BizTalk Mapping, pick up Pro Mapping in BizTalk Server 2009.  Odds are that a problem of your nature is discussed therein.  We have multiple chapters on looping in the book.

    Regards,

    Jim -- Pro Mapping in BizTalk 2009, Apress Books, March 23, 2009
    Tuesday, April 28, 2009 4:40 PM
  • Hello Jim,

    Thanks for your time and replay, I am sorry for my late replay unfortunately I had to leave the office yesterday.  Actually I ordered the “Pro Mapper 2009” book two days ago and I hope that it will arrive before the weekend.

    I have posted a screenshot of the NAD-loop at http://demo.eocc.se/biztalk/nadloop/NAD-BY_and_NAD-SU.gif. The first loop (marked by a red rectangle) sets the BY value and the second loop sets (marked with a blue rectangle) the SU value.  As you will see in the screenshoot  I used some other values in the example.

    It seems that the mapper tries to process both loop at once, but I want to process loop one then redo the NAD-loop with some new values.

     

    Kind regards,

    Thomas

    Wednesday, April 29, 2009 7:50 AM
  • Thomas,

    I'll be out most of the day -- just checking email now -- but here is the
    obvious:

    Linking two Looping functoids to the same output node does not work, as the
    engine can not figure out the logic.  Linking two input nodes to the SAME
    Looping functoid will work when both input nodes are under the same parent.
    At a glance, this appears to be your case.

    Try removing the bottom Looping functoid and then linking the
    AdditionalInformation node to the remaining looping functoid.  This should
    produce the two loops you need.  Of course you will have to control the flow
    of data to get pieces in the correct iteration.

    If that does not work, let me know and I'll send you an XSLT Template
    example.

    Regards,

    Jim -- Pro Mapping in BizTalk 2009, Apress Books, March 23, 2009
    Wednesday, April 29, 2009 1:53 PM
  • Hello!

    Do you (or anyone) know any good article which describes how the “mapper” engine works in which order it process loops, data and so forth?

     Regards,

     Thomas, eocc.se

    Thursday, April 30, 2009 6:47 AM
  • Thomas,

    That information is in the book.  Essentially, the engine moves down the target schema, node by node.  Children are executed before parents, except:

          Output control such as looping functoids or logical functoids that control the output of the node are executed first.

    This means global variables, such as counters, that are attached to the parent will not be instantiated or modified until the children of the parent have been processed.

    That's a small percentage of the whole process of course.  You can see the order of processing by validating your map and then examining the XSLT to see the logic.  This is also covered in the book with examples of how to read the XSLT.  You'll be surprised at how the engine interprets some of the links.


    Jim -- Pro Mapping in BizTalk 2009, Apress Books, March 23, 2009
    Thursday, April 30, 2009 2:50 PM
  • Hello Jim,

    Thanks for your tips and hints, here is one solution (of probably many) of the problem.
    Use a Loop from two of the source segments that output to the destination segment.

    Then use a Logical existence and a Value Mapper to output the data to the destination, set a value that is true for each loop in my case Customers and Supplier.

    I have posted a image at : http://demo.eocc.se/biztalk/nadloop/NAD-BY_and_NAD-SU-solution.gif

    Kind regards,

    Thomas

    Monday, May 11, 2009 8:32 AM
  • Thomas,

    If that will work, you might try using just a logical existence and a value mapping (flattening) functoid.  The purpose of the value mapping  (flattening) functoid is to pull all the objects of a loop through and allow only the correct one to be output.

    Also please note that the logical existence functoid may not perform as you expect.  That functoid will return 'true' if the source node is present but has no data, as is often the case when an application does not suppress empty nodes.  It is usually better to use the logical string functoid (or number, etc.) rather than the logical existence since they test for the presence of data in the node.

    Take care,

    Jim
    Jim -- Pro Mapping in BizTalk 2009, Apress Books, March 23, 2009
    Monday, May 11, 2009 1:00 PM