Map -> From XSD Schema to Flat File Schema

Home Page Forums BizTalk 2004 – BizTalk 2010 Map -> From XSD Schema to Flat File Schema

Viewing 1 reply thread
  • Author
    Posts
    • #15106

      Hello and thanks for your assistance.

      I have 2 schemas, one is a normal xsd schema and the second is a flat-file \”|\” character delimited.

      Schema1:
      Order
      -> FirstName (attribute)
      -> Lastname (attribute)
      -> LineItems (child record)
      -> -> LineItem (child record)
      -> -> -> ProductId (attribute)
      -> -> -> Quantity (attribute)

      Schema2: Flat-File, Pipe character delimited
      Root
      -> FirstName
      -> LastName
      -> ProductId
      -> Quantity

      * An Order can have multiple LineItems.
      What I need to do is for each lineitem map a new record in the Flat-File Schema.

      I thought that i would be able to just add a looping functoid from Schema1->Order->LineItems to Schema2->Root record and for each record in the LineItems it would create a new record in Schema2, but this does not work.

      For Example: If thier is 2 lineItems in Schema1 I need Schema2 to look like this:

      firstName|lastName|item_1|quantity_1
      firstName|lastName|item_2|quantity_2

      Does anyone have any suggestions to help me out with this.

      Thanks,
      –Steven

      • #15107

        Awsome reply.

        I’ll give your suggestions a try and let you know how it goes.

        Thanks,
        –Steven

    • #15105

      try moving the looping functoid to the lineitem instead of the lineitems record.
      I assume that the lineitems record is the parent and the lineitem is a repeating record.
      That might work.

      if it doesnt, on your outbound flat file schema (schema2) set ProductID max occurs to 1 and map directly to it. the ffassembler should be smart enough to create an new instance for each .

      if again that doesnt work. use a table looping functoid with the loop indicator set at the root of schema2. now the table extraction functoid to the product id and the other repeated data will just fall below the table extraction functoid. ( this should create a new instance for each loop and copy the data over again.

      if THAT doesnt work, create a normal schema that mimics the actions that you would like to output, put that into the map and use a looping shape in the orchestration to map to schema 2 and then send out through your pipeline.

      I highly doubt you will need to go to those lengths, but you never know. I think that the first solution should work, and if you test it, and no errors occur AND only one line item appears in the output, then that is the correct behavior. when you test any flat file schema map, it will only do the first instance and report a success. the output will seem like it lost all the other loops, but in fact, they remain in the stream within the pipeline, so the assembler will go ahead and create a whole new instance until the stream is complete.

      hit me up again if it doesnt work and maybe send me a sample. hopefully this wont hold you up too long. 😀

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.