Flatfile schema out put removing double quotes issue

Hi Guys

I am having below issue…I am using Flatfile schema to convert CSV file to values by using convertToValues.

Below I attached the package for document,dictionary and flatfile schema .Also I am attaching the CSV file and screen shots from my test results with comments

.I am using release quote character as " (Double quotes) which is mandatory to use the double quotes.Double quotes not appearing in the output from flatfileschema output.I want double quotes in the expected output.

Current Output : {key: IsReprint, value:COPY};{key: IsCancelled, value:CANCELLED}
Expected output should be : {“key”: “IsReprint”, “value:COPY”};{“key”: “IsCancelled”, “value”:”CANCELLED”}

Kindly advise how to do this.

Thanks
Murali

Screenshots.docx (183 KB)
CSVfile.zip (1.58 KB)
FlatFileSchemaTest.zip (6.82 KB)

Hi Murali,

did you try to remove the Quote Release Character from your Schema Definition?

On the other side is there a specific reason why you want the quotes in the output?
Quotes are usually used in CSV to allow field delimiters to appear in fields content without splitting it into two fields.

Regards,
Holger

Hi Holger,

Thanks for assisting me here.

Yes I do try that …but as comma is my delimiter (Field or composite value) out put separating where ever comma presented.That is the reason I have to use " double quotes as my quote release character.

I agree with your last point why quotes are used but unfortunately my requirement as below.

The first double quote and last double quote should be ignored for each record in the document.All other quotes in the data should be remain.

Is there any way to achieve this ?

Hope you understand the requirement

Thanks
Murali

Yes, we can achieve this…

You can use format service to append double quotes on your CSV FF field values.

  1. Create a flow Service with Specification Reference=> WmFlatFile/pub.flatFile:FormatService

  2. Invoke Concat util service:

    ServiceIn:
    inString1= “”
    inString2= Map your field value

    ServiceOut:
    Value to Pipeline Out/formattedValue

  3. Again Invoke Concat util service:

    ServiceIn
    Map formattedValue to inString1
    inString2= “”

    ServiceOut:
    Value to Pipeline Out/formattedValue

4)Service is ready now . In your flatFile dictionary,now you may assign the service to those fields property i.e. FormatService

Please refer the attachment (Example_Append Double Quotes)
Example_Append Double Quotes.png

I’m skeptical that there is a “requirement” to blindly put quotes around every field value. Many systems “lazily” do this when creating delimited files but it isn’t necessary.

The only reason to quote a field (or using any character as the release quote char – but typically quote) is because it contains a delimiter (field or record) in the data. The generally accepted conventions (alas, there is no standard) are:

  • Place quotes around fields that contain character(s) used as delimiters. These quotes are not part of the data and parsers are to strip them during processing.

  • If the field contains a quote, escape that quote with another. Parsers unescape this.

The flat-file services abide by this and place quotes around a field ONLY if the value contains delimiters, or a quote.

The sample data seems quite similar to JSON, which requires quotes around field names and all values that are string data type. Is that what you’re really trying to create? If so, the flat-file service are not what you want to use.