none
X12 to flat file RRS feed

  • Question

  • Hello guys, I'm trying to acheive a simple task (at glance), from any X12 document (in this case 856) but the question is about functoids mainly.
    I need to map it to a flat positional file , with only one record.

    So the source for example (simplified for the sample):

    HL|2|2|P|0
    LIN|900001|BP|FE0120-035|IZ|1SIZE|AV|01000|ZZ|30|CH|CN
    HL|3|2|P|0
    SN1||96|EA
    MAN|SM|000167992
    HL|4|2|P|0
    SN1||96|EA
    MAN|SM|000167993

    And the destination file is online per record , so it should go like (showing what fields should map):

    Order of segments in resulting flat file: LIN01-MAN02 (repeating)

    900001000167992
    900001000167993
    900002000167994
    ....


    Please note that it repeats the LIN01 , also looping if there are more than one LIN segment , and also loops the MAN02.

    Any ideas ?

    Thank you so much
    Wednesday, July 1, 2009 12:08 PM

Answers

  • In the map you can connect the Loop node across to the flat-file node that can repeat to get it to loop for you. So in your EDI schema if you have a LINLoop and in your flat file schema you have a LINLoop, just connect these two items. You may also need to loop the MANLoop to the related loop item in your flat file schema.

    In the flat file a loop node could be one with MaxOccurs > 1 such as MaxOccurs = Unbounded.

    Thanks,


    If this answers your question, please use the "Answer" button to say so | Ben Cline
    • Marked as answer by VictorDV Thursday, July 2, 2009 1:41 AM
    Wednesday, July 1, 2009 3:20 PM
    Moderator

All replies

  • In the map you can connect the Loop node across to the flat-file node that can repeat to get it to loop for you. So in your EDI schema if you have a LINLoop and in your flat file schema you have a LINLoop, just connect these two items. You may also need to loop the MANLoop to the related loop item in your flat file schema.

    In the flat file a loop node could be one with MaxOccurs > 1 such as MaxOccurs = Unbounded.

    Thanks,


    If this answers your question, please use the "Answer" button to say so | Ben Cline
    • Marked as answer by VictorDV Thursday, July 2, 2009 1:41 AM
    Wednesday, July 1, 2009 3:20 PM
    Moderator
  • Thank you Ben,  it's working perfectly now

    Victor
    Thursday, July 2, 2009 1:41 AM
  • Also, just as a follow-up, if you need to customize the looping behavior, you can switch over to a custom XSLT to have better control over how the loop works or do nested looping, etc.

    If you validate the map it will generate an XSLT and then you can refer to this in the custom XSLT properties of the map. After doing these steps you can customize the XSLT.

    Another tip is that with BizTalk 2009 you can debug a map which steps you through the XSLT.

    Good luck,

    If this answers your question, please use the "Answer" button to say so | Ben Cline
    Thursday, July 2, 2009 4:04 PM
    Moderator