AnsweredAssumed Answered

How can I combine multiple lines from EDI profile into a single XML element?

Question asked by PatrickBrilino6911 on Jun 21, 2016
Latest reply on Jun 29, 2016 by AsheeshSharma6371

I have and EDI 810 source file which looks like the attached file.  I need to concatenate all of the REF*SN lines so that the serial numbers appear on the same line as the line above it. 

 

In short, these lines of the attached EDI file:

IT1*1*2*EA*0.00*TE*VN*NX-1465-G4-2640V3

REF*SN*16AP65120052

REF*SN*16AP65120051

IT1*9*2*EA*0.00*TE*VN*NX-1365-G4-2640V3

REF*SN*16AP65120055

REF*SN*16AP65120056

 

 

Need to look like this:

<lineList>

     <line>

  <linenum>1</linenum>

  <sku>NX-1465-G4-2640V3</sku>

  <qty>2</qty>

  <serialnumbers>16AP65120052,16AP65120051</serialnumbers>

  </line>

  <line>

  <linenum>2</linenum>

  <sku>NX-1365-G4-2640V3</sku>

  <qty>2</qty>

  <serialnumbers>16AP65120055,16AP65120056</serialnumbers>

  </line>

</lineList>

 

I can handle the mapping from EDI to XML, but the serial numbers on different lines are giving me trouble.  I've tried splitting and combining the docs and mapping to XML, but that doesn't seem to work.  Do I need to use Groovy scripting to accomplish this, or is there a way to do it from within a map?

Attachments

Outcomes