IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

CSV to XML Options · View
Stewart Murray
Posted: Friday, August 7, 2020 8:52:14 AM
Rank: Newbie

Joined: 8/7/2020
Posts: 4
Location: United Kingdom
Hi,

Hopefully someone can help, any guidance would be greatly appreciated

I'm mapping a csv extract to XML for an order confirmation routine and hitting a brick wall for line number information. I'm likely missing something simple though!

I need to be able to recognise when a line number from the csv is not unique and map additional information for that line

The csv comes our with one line per line of despatch -

10,SKU,Description,Qty,BatchNo
20,SKU,Description,Qty,BatchNo
30,SKU,Description,Qty,BatchNo

However if there is a split batch number, it will repeat the line number -

10,SKU,Description,Qty,BatchNo1
10,SKU,Description,Qty,BatchNo2
20,SKU,Description,Qty,BatchNo
30,SKU,Description,Qty,BatchNo

There could be any number of lines on an order and any number of repetitions of those line numbers depending on the stock picked.

The XML requires a unique line (POSNR) for each product line, and where there is a split batch number, add another section with the split details -

<E1EDL24>
<POSNR>10</POSNR>
<MATNR>SKU</MATNR>
<LFIMG>Qty</LFIMG>
<HIPOS>0</HIPOS>
</E1EDL24>
<E1EDL24>
<POSNR>900001</POSNR>
<MATNR>SKU</MATNR>
<CHARG>Batch No1</CHARG>
<LFIMG>36</LFIMG>
<HIPOS>10</HIPOS>
</E1EDL24>
<E1EDL24>
<POSNR>900002</POSNR>
<MATNR>SKU</MATNR>
<CHARG>Batch No2</CHARG>
<LFIMG>36</LFIMG>
<HIPOS>10</HIPOS>
</E1EDL24>
<E1EDL24>
<POSNR>20</POSNR>
<MATNR>SKU</MATNR>
<CHARG>Batch No</CHARG>
<LFIMG>72</LFIMG>
<HIPOS>0</HIPOS>
</E1EDL24>
<E1EDL24>
<POSNR>30</POSNR>
<MATNR>SKU</MATNR>
<CHARG>Batch No</CHARG>
<LFIMG>72</LFIMG>
<HIPOS>0</HIPOS>
</E1EDL24>
K101
Posted: Friday, August 7, 2020 9:30:04 AM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 565
You need to use grouping, an intermediate variable, and duplicate the E1EDL24 item in the variable.

File Attachment(s):
example.zip (3kb) downloaded 37 time(s).

K101 attached the following image(s):
example.png

Stewart Murray
Posted: Wednesday, August 12, 2020 7:51:33 AM
Rank: Newbie

Joined: 8/7/2020
Posts: 4
Location: United Kingdom
Thanks for this K101

The batch number field within the csv file could be any value so I think it would need to split out based on the value of the line number? i.e. generate the additional sections only when the line number is the same value as the previous line?
K101
Posted: Thursday, August 13, 2020 9:28:29 AM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 565
If your actual input data differs from what you already described of course you may need to modify the mapping to accommodate it.
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.