how add double quotation to a column?

Highlighted
Six Stars

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.

  

Highlighted
Community Manager

Re: how add double quotation to a column?

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
----------------------------------------------------------
Talend | Data Agility for Modern Business
Highlighted
Seven Stars

Re: how add double quotation to a column?

Hi pawe84,

 

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

Thanks & Regards
A Ravi Kumar
Mobile Number : +91 852-762-1083
Email-id : a.ravikumar104@gmail.com
Skype Id : ammanannaravikumar
Highlighted
Six Stars

Re: how add double quotation to a column?

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"

Highlighted
Seven Stars

Re: how add double quotation to a column?

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.

 


Regards,
Mohit

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog