Five Stars

Talend Data Mapper looping

Hello, I don't know how to modify my map:

my input file :

H|R1602-0345|AN|20160219|WATER01|13480
D||1000|CD1602-1018|1000|NET0000043|ZETAG 9048FS|KG|200||

H|R1602-0346|AN|20160219|JOHNS|82164365
D||1000|CD1602-0946|7000|NET0000055|HYPOFOAM FUT 234kg|KG|468||

H|R1602-0347|AN|20160219|EXPRI|023530
D||1000|CD1602-0998|1000|ETI5061000|ETI LK TEA PECHE 20CL|UN|463200||
D||2000|CD1602-0998|2000|ETI5081007|ETI PAQ FRUIT'O tropical 4X20C|UN|463200||
D||3000|CD1602-0998|3000|ETI5081008|ETI PAQ FRUIT'O MULTI  4X 20CL|UN|480000||
D||4000|CD1601-0763|1000|ETI6061200|ETI LK LIMONADE 50CL|UN|270000||
D||5000|CD1601-0763|2000|ETI6061201|ETI LK COLA 50CL|UN|270000||
D||6000|CD1601-0763|3000|ETI6221201|ETI STB GAZEIFIEE JAPON 50CL|UN|243000||
D||7000|CD1601-0166|1000|ETI5051401|ETI TOP BUDGET ASEP MUTIVIT 1L|UN|172000||
D||8000|CD1601-0166|2000|ETI5081427|ETI PAQ ASEP MULTIVITAMIN 1L|UN|172000||
D||9000|CD1601-0166|3000|ETI5081433|ETI PAQ ASEP cranberry/framboi|UN|172000||
D||10000|CD1601-0166|6000|ETI5621400|ETI pur jus citron  Carthagino|UN|172000||
D||11000|CD1601-0166|7000|ETI5081436|ETI PAQ ASEP POIRE 1L|UN|150500||
D||12000|CD1601-0166|8000|ETI5081437|ETI PAQ ASEP PECHE 1L|UN|107500||
D||13000|CD1601-0166|9000|ETI5081438|ETI PAQ ASEP ABRICOT 1L|UN|150500||
D||14000|CD1601-0166|10000|ETI6061400|ETI LK Cola  1L soda ligne K3|UN|172000||
D||15000|CD1601-0532|1000|ETI6221500|ETI STB NATURE 1L25|UN|430000||
D||16000|CD1601-0532|1000|ETI6221500|ETI STB NATURE 1L25|UN|430000||
D||17000|CD1601-0532|1000|ETI6221500|ETI STB NATURE 1L25|UN|344000||
D||18000|CD1601-0532|2000|ETI6221501|ETI STB NATURE 1L25 G|UN|172000||
D||19000|CD1601-0532|3000|ETI6311500|ETI BEL FRAN  EAU GAZEIF 1L25|UN|172000||

And i want to produce a xml file which loop  on the header element  with the "command order" which is in the lines (line begin by D and Command order is in bold) and group in <lines> all the lines from this "command order"

map.pngexpression.png

Sorry for my poor english spoken

Thanks for your help

 

Tags (1)
6 REPLIES
Eight Stars

Re: Talend Data Mapper looping

Hi,

 

Could you upload your map, a test input file and the XML expected file.

 

Eric

Five Stars

Re: Talend Data Mapper looping

I have uploaded the map files below :

A_0103_X3.zip

Thanks for your Help

 

Eight Stars

Re: Talend Data Mapper looping

Hi,

Sorry for my late answer...

 

Here is a solution.

There are two maps:
-A first one 0103_INTER_CSV_2_FLATXML:
it translate the CSV to a XML without nested loop.

Capture.PNG

Then this map calls the second map 0103_INTER_FLATXML_2_XML:

Capture.PNG
-A second map 0103_INTER_FLATXML_2_XML (Called by 0103_INTER_CSV_2_FLATXML):
it translate the flat XML to a XML with nested loop for lines

Capture.PNG

 

Capture.PNG

Let me know if it meets your requirements.

 

NB: I didn't find how I can attached these map files to this post...

 

Regards.

Eric

Five Stars

Re: Talend Data Mapper looping

I have used ETL process for my problem.

The next time, i 'll try with your solution.

Thanks you.

Five Stars

Re: Talend Data Mapper looping

But i have another problem in a route using a cMap, il have a error :

 

org.talend.transform.camel.TdmException: Cant figure out payload: '{0}'
    at org.talend.transform.camel.TdmProcessor.process(TdmProcessor.java:445)
    at org.talend.transform.camel.TdmEndpoint.onExchange(TdmEndpoint.java:121)
    at org.talend.transform.camel.TdmEndpoint$1.process(TdmEndpoint.java:109)
    at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)

 

When i test the cMap, i have the expect result but i don't knom where to search solution for these errors, have you a idea ?

 

Thanks

Eight Stars

Re: Talend Data Mapper looping

Hi,

 

Could you upload your route and a test input file ?

 

Eric