Text Enclosure under CSV option of tfileOutputDelimited

Five Stars

Text Enclosure under CSV option of tfileOutputDelimited

Suppose I input file with data below (1st row as header)

Column1|Column2|Column3|Column4
XYZ||ABC|
|LMN|ADI|MLN
GHI||LLL|AAA

I am expecting the output to have value as below

Output file data :-

Column1|Column2|Column3|Column4
"XYZ"||"ABC"|
|"LMN"|"ADI"|"MLN"
"GHI"||"LLL"|"AAA"

Whereever we have some value in a field ,it should be within double quotes (""). If no value is present in that field then no double quotes required. Fields are separated by |.

I am not able to do this using Text Enclosure under CSV option of tfileOutputDelimited.

Sixteen Stars TRF
Sixteen Stars

Re: Text Enclosure under CSV option of tfileOutputDelimited

You need an additional subjob to rework the outputfile after it has been produced with your actual tFileOutputDelimited.

In this new subjob, read the file with a tFileInputInputFullRow then in a tMap replace all the "" with the following expression:

row1.line.replaceAll("\"\"", "")

Then rewrite the output file with another tFileOutputDelimited component.

 


TRF
Nine Stars

Re: Text Enclosure under CSV option of tfileOutputDelimited

check csv options

csv options.PNG

Regards
DGM
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

2019 GARNER 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

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read