webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Efficient method to create CSV with double quotes

  • 1.  Efficient method to create CSV with double quotes

    Posted Wed April 22, 2009 06:09 PM

    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.


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 2.  RE: Efficient method to create CSV with double quotes

    Posted Wed April 22, 2009 06:29 PM

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


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 3.  RE: Efficient method to create CSV with double quotes

    Posted Wed April 22, 2009 07:10 PM

    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.


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 4.  RE: Efficient method to create CSV with double quotes

    Posted Wed April 22, 2009 07:15 PM

    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.


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 5.  RE: Efficient method to create CSV with double quotes

    Posted Wed April 22, 2009 09:23 PM

    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.


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 6.  RE: Efficient method to create CSV with double quotes

    Posted Mon June 08, 2009 07:07 PM

    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


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 7.  RE: Efficient method to create CSV with double quotes

    Posted Mon June 08, 2009 07:46 PM

    Yes. I basically manually concatenate the double quotes.


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 8.  RE: Efficient method to create CSV with double quotes

    Posted Mon June 08, 2009 08:45 PM

    HI Pthcincy,

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

    Thanks in Advance,
    JSree


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 9.  RE: Efficient method to create CSV with double quotes

    Posted Mon June 08, 2009 09:34 PM

    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.


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 10.  RE: Efficient method to create CSV with double quotes

    Posted Tue June 09, 2009 01:57 AM

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

    Thank you…


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB