Six Stars

Add double quote to all output row of tMap

Hi all,

I have tMap input row with 1000 column, how to add double quote to all tMap output column ?

example:
input:
1,Hieu,20,VietNam,...

outPut:
"1","Hieu","20","VietNam",...

Thanks,

 

  • Data Integration
5 REPLIES
Six Stars sgv
Six Stars

Re: Add double quote to all output row of tMap

Hi,

lolilol.PNG

 

In the tFileOutputDelimited, advanced setting use the options CSV.

But don't use it on tFileInputDelimited. And all your column's schema muste be of String Type. It's not beautiful but it's work and you don't have to pass on every column ^^

 

Good luck ,

 

SGV

Six Stars

Re: Add double quote to all output row of tMap

Thank you, it's work.
But I don't want export null column to double quote, how to escape null value ?
Nine Stars TRF
Nine Stars

Re: Add double quote to all output row of tMap

Use tFileInputFullRow to read the file with all the " then pass the result to a tMap and use row1.line.replaceAll("\"\"", null) to replace empty strings by null.
It should work.

TRF
Six Stars sgv
Six Stars

Re: Add double quote to all output row of tMap

Lol it's complicate !

If it's just for 1 time , open your file and replace the  ""   by noting. With notepad++ it's easy to do.

If you want to do this automatically in your job, the purpose is to reproduce the action above.

So

Capture.PNG

You have to add a step.

For exemple :

-  tfileoutputdelimited_2 create a file named : out1.csv

-  tfileInputdelimited_5 read the file named out1.csv, but the schema have only one column wich represent the line (type String). seperate line stay same "\n", but use seperate column like "&&&"

- in you tjavaflex use this :  row15.myLine = row14.myLine.replace("\"\"","");    (this will replace all your "" by nothing)

- tfilOutputDelimited_3 create a file named out2.csv. Don't use option CSV, separate line is the same "\n", and we don't care about the separate column because we have only one column !

- tFileInputDelimited_4, read the file out2.csv, and have the same parameter than before. Juste change the name of file readed by the component

 

Maybe there are other solution ^^

 

Good luck

SGV

Six Stars

Re: Add double quote to all output row of tMap

Hi TRF,
Where do I put row1.line.replaceAll("\"\"", null) to ?