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>
|
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):
|
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?
|
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.
|