One Star

Adding a header to an output file with double quotes.

Hi Guys,
I hope you can help me with this.
I need to be able to put " around my header in a tFileOutputDelimited file for load.
When I read it (intFileInputDelimited) it looks likes this:
"Key","Item","Data"
"1", "Milk", "Bottle"

I need it in the exact same format in the tFileOutputDelimited after some manipulation but what I am seeing is:
Key,Item,Data
"1", "Milk", "Bottle"
Is there any easy way of doing this apart from splitting them about merging back together.
Second problem is, Ive tried to split them and use tUnite which works if I had only one file.
But since I need to read in a bunch of files and add the same header I cannot get it to work.
I am using a tFileList - intFileInputDelimited and tUnite to a static intFileInputDelimited file(header) but it seems to be in a loop of some sort. I expect Im missing a component but dont know what.
Thanks,
Adrian.
4 REPLIES
One Star

Re: Adding a header to an output file with double quotes.

Have you tried treating the header as data?
One Star

Re: Adding a header to an output file with double quotes.

Yes but I had some transformation to do so I couldnt use that. In the end, my problem was with the header in that Talend converted - to _ when reading the metadata to create the header so i had to change accordingly.
Four Stars

Re: Adding a header to an output file with double quotes.

Yes, reason being, Talend converts all the special characters in the input metadata to "_". It makes sense to have column names in double quotes when there is an option to have data in double quotes. But how?
Five Stars

Re: Adding a header to an output file with double quotes.

It's not elegant but why not write your headers separately.
Create a String with your quotes headers and write this to your file.
Then append your data but without headers.