Bring multiple columns from csv into xml loop

Four Stars

Bring multiple columns from csv into xml loop

Hello,

i'm new to the talend and im trying to use Talend Open Studio for Data Integration for converting csv into an xml file. I ran into trouble because i am having multiple columns bullet1 - bullet20 which I want to bring into the loop custom-attributes. Basic idea is to use the flatfile columns to fill a new attribute in the xml with the content of the columns. I know whats showed on the image does not work, its just to demonstrate the problem. I got 20 input cols which should each create a xml node inside of custom-attributes.

 

Unbenannt.PNG

 

Any ideas on that?

 

 

Big thanks in advance!

i3

Thirteen Stars

Re: Bring multiple columns from csv into xml loop

@kolfe since you need to concatinate columns like row3.bullets1 || row3.bullets2.

try in this way.

Manohar B
Four Stars

Re: Bring multiple columns from csv into xml loop

Thanks for your input. That doublepipe will throw an error: "The operator || is undefined for the argument type(s) java.lang.String, java.lang.String". I could use + to concat but that would put all togehther into the same node and not one custom-attribute node each.

Thirteen Stars

Re: Bring multiple columns from csv into xml loop

yes you can use + to 

Manohar B
Thirteen Stars

Re: Bring multiple columns from csv into xml loop

you can add into single node using +

Manohar B
Four Stars

Re: Bring multiple columns from csv into xml loop

xml result should look like this:

...
<custom-attribute>{row3.bullets1}</custom-attribute>
<custom-attribute>{row3.bullets2}</custom-attribute>
<custom-attribute>{row3.bullets3}</custom-attribute>
<custom-attribute>{row3.bullets4}</custom-attribute>
...


not likes this

<custom-attribute>{row3.bullets1} {row3.bullets2} {row3.bullets3} {row3.bullets4}</custom-attribute>