I must map a flat file that has the following format to a XML structure. I have made a template (included in attachment) and the file is loading OK in the record so I have all my data in the pipeline. The file (an invoice) has 1 field per line instead of having many fields on 1 line. So for detail records, it goes like this :
…
301 0001
305 MMM651
310 Product description
325 5
335 2.39
301 0002
305 MMM652
310 Prod desc 2
325 10
335 4.35
…
My goal is to load this to an XML structure like this :
…
<invoiceline>
<linenumber>
<number>0001</number>
</linenumber>
<itemquantity>
<quantity>000005</quantity>
</itemquantity>
<productid>
<id>MMM651</id>
<description>Prodcut Description</description>
</productid>
<unitprice>
<amount>23900</amount>
</unitprice>
</orderline>
<orderline>
<linenumber>
<number>0002</number>
</linenumber>
<itemquantity>
<quantity>000010</quantity>
</itemquantity>
<productid>
<id>MMM652</id>
<description>Prod desc 2</description>
</productid>
<unitprice>
<amount>43500</amount>
</unitprice>
</orderline>
…
I’ve tried many LOOP, MAP combined with appendToRecordList to a temp records and/or directly to my XML structure but was not able to produce an output that was making sense. The best I could do was having the correct line detail structure but with the same data in each detail line
I’m sure somebody in here has done something similar ?
Thanks for your help !
flat file invoice template
AlphaInvoiceTemplate.xml (14.6 k)