Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
pawe84
Creator

how add double quotation to a column?

Hi everyone,

 

I need to add double quotation to a column which will be exported into a csv.

I just saw that the component tFileOutDelimited has an option for text enclosure but there I can't

select the right column it will put double quotes on all my column values.

 

Let's say the column is called product description.

The string is something like: abc wheel size 16"

Which component do I need that the csv will show "abc wheel 16" "?

Do I have to replace the double quote on 16 inside the string  so that a csv parser is able to know that this is not the end of the string?

 

Thanks for any tips.

  

Labels (2)
4 Replies
Anonymous
Not applicable

Hi
If you just want to add double quote to one column, do it on tJavaRow or tMap, eg:
tfileinputDelimited--tJavaRow--tFileOutputDelimited
...other columns...
output_row.columnName="\""+input_row.columnName+"\"";

Regards
Shong
Anonymous
Not applicable

Hi pawe84,

 

We can use StringHandling.DQUOTE("Hello") function in talend to put double quotation for a string.

pawe84
Creator
Author

Nice but what about the double quote inside a string? Will it be escaped?

 

Inside the csv I need this pattern e.g.    wheel size 24"" that the parser is able to convert it into: wheel size 24"

mks02
Creator

I took this as an example:


ID,NAME,DESCR
1,TITU,Titu wheel size 16"

and pass this to tFileOutputDelimited as FilName.csv with field separator ",".
After running the job, it will show the record as it is (TITU,Titu wheel size 16") with double quotes at the end.
No need to use CSV option in AdvanceSettings.