# Surrounding data with double quotes for a CSV file

**URL:** <https://forum.cloverdx.com/t/surrounding-data-with-double-quotes-for-a-csv-file/656>\
**Category:** CloverDX Platform\
**Created:** [January 28, 2010, 12:00am UTC](https://forum.cloverdx.com/t/surrounding-data-with-double-quotes-for-a-csv-file/656 "2010-01-28T00:00:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pokemon](https://avatars.discourse-cdn.com/v4/letter/p/7c8e57/32.png) [@pokemon](https://forum.cloverdx.com/u/pokemon)\
**Post date:** [January 28, 2010, 12:00am UTC](https://forum.cloverdx.com/t/surrounding-data-with-double-quotes-for-a-csv-file/656/1 "2010-01-28T00:00:00Z")

</div>

Hi,  
I’m using Clover’s Java API to write into a CSV file using the DELIMITED\_DATA\_WRITER component. Is there any way to enforce Clover to surround all data values including Date, Integer, Double etc with a double quote?

I have a REFORMAT component that does some formatting prior to the execution of the DELIMITED\_DATA\_WRITER component. I have been able to use this component to successfully surround the String values with double quotes, but not the other data types. If I do so, it understandably throws a BadDataFormatException since it is of type java.util.Date. Is there a way to do it via Clover’s API otherwise?

I’m using Clover’s 2.7.2 API.

Thanks in advance!  
Pramod

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [January 28, 2010, 10:55am UTC](https://forum.cloverdx.com/t/surrounding-data-with-double-quotes-for-a-csv-file/656/2 "2010-01-28T10:55:31Z")

</div>

Hello Pramod,  
I see two solutions of your problem:

- Output metadata from Reformat node contains only string data field with quoted values

- Use [StructureWriter](http://wiki.clovergui.net/doku.php?id=components:writers#structurewriter) instead of Universal or Delinited Data Writer, with body mask like _“$field1”,“$field2”,“$field3”…_

---

<div class="post-metadata">

**Author:** ![pokemon](https://avatars.discourse-cdn.com/v4/letter/p/7c8e57/32.png) [@pokemon](https://forum.cloverdx.com/u/pokemon)\
**Post date:** [January 29, 2010, 10:32am UTC](https://forum.cloverdx.com/t/surrounding-data-with-double-quotes-for-a-csv-file/656/3 "2010-01-29T10:32:45Z")

</div>

Thanks Agata!  
I was able to fix my problem successfully with the StructureWriter.

But I’ve just one clarification, do I need to explicitly specify a record delimiter (a new line in my case) while specifying the mask? or is there a way i can tell the StructureWriter to put a new line after every record it writes?

Since I’m using it to write CSV files, I’m currently specifying the mask as

```auto
"$field1","$field2",....,"$fieldn"\n

```

to get it to write every record on a new line.

Thanks,  
Pramod.

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [January 29, 2010, 11:20am UTC](https://forum.cloverdx.com/t/surrounding-data-with-double-quotes-for-a-csv-file/656/4 "2010-01-29T11:20:46Z")

</div>

Hello Pramod,  
you are right - the record delimiter must be specified in the mask. There is no other way to put in to the file. If you suppose that the graph can run on various systems use parameter for it:

```auto
"$field1","$field2",....,"$fieldn"${rec_delimiter}

```
