Efficient method to create CSV with double quotes

I was wondering if anyone have an efficient method of creating CSV from IS document that includes header names and the data wrap with double quotes. I suppose you can create a flow service which does a bunch of concatenation that includes the double quotes.

If you’re using pub.flatFile:convertToString you can use the quotedRelease parameter to do this.

reamon,

This is what I’ve done thus far. I’ve created a ff dictionary along with a schema. In the schema, I’ve defined the ff definition record parser as “Delimiter”, record character as “newline”, Field or Composite as “,”. I then use pub.flatFile:convertToString.

Output --> 1234,ABC

hardcoded double quote " to quotedRelease and got:

Output --> 1234*ABC

Desired Output --> “1234”,“ABC”

I guess concatenation cannot be avoided in order to get the desired output.

Actually, I also wanted the fieldnames as well.

Desired Output --> name1,name2
“1234”,“ABC”

I was hoping to avoid concatenation (fieldnames, double quotes) in the flow service to produce the desired output. I thought maybe creating the schema would be efficient but I guess I would need to do additional steps. If anyone know of a better method, please let me know. Thanks.

I think the flat file services can output a header row of field names but I’ve forgotten where that would be indicated.

You can also specify quotedRelease in the FF schema. But the quotedRelease will only put the quotes if the field contains a delimiter character. If you need quotes on everything, then this won’t work for you.

Another possibility is through a custom format service that will be called by convertToString. Within it you can add the quotes.

Hi Pthcincy,

you got this working I am having similar requirement, As reamon suggested you wrote any custom service for this? My desired out should be “22222”,0,“RAJ”, like this…

Thanks,
JSree

Yes. I basically manually concatenate the double quotes.

HI Pthcincy,

Can you please tell me in detail how do you concatenate double quotes for each field? After ConvertToString …

Thanks in Advance,
JSree

What I did was to get it into an IS document and in one of my MAP step, I basically use the concat transformer to map the string element with the open quote string from the pipeline in to the pipeline out. Then the next MAP step is concat the end of the quote string.

I got it now . I use multi concat transformer and mapped for each record.

Thank you…