Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
markadavies
Contributor III
Contributor III

STORE to csv - quotes

I need to create a '|' separated csv file with each field value within quotes to allow upload to a central database.

My Store command creates the csv file, but the quotes that I have included with each value are written inside additional sets of quotes

For example, if I want to export a field value "ABC", the resultant csv file actually contains """ABC"""

Is there any way to prevent this happening without any further actions after my script has executed? (I don't want to use macros or have to process the file again in VB etc.)

I have tried to include a 'no quotes' parameter to my Store command to no avail

The STORE command I am using is similar to this

STORE MyTable INTO mycsvfile.csv (txt, delimiter is '|');

11 Replies
m_woolf
Master II
Master II

If all fields contain quotes, you could do:

replace(Field,'"','') as Field

That would remove the quotes from the field.

swuehl
MVP
MVP

You can vote for this idea and hope it's getting implemented soon..

marcus_sommer

A workaround could be to create already your table in this way, like:

csvTable:

Load F1 & '|' & F2 & '|' & F3 & '|' & F4 ... as csvField From xyz;

store ...

- Marcus

jonathandienst
Partner - Champion III
Partner - Champion III

Only problem is that produces a header line in line 1 reading csvField. One possible workaround

csvTable:

Load F1 & '|' & F2 & '|' & F3 & '|' & F4 ... as [F1|F2|F3|F4] From xyz;

store ...

but I think the F1 and F4 fields will contain the square brackets [F1 and F4]...

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
marcus_sommer

Of course, you are right and it might need a combination from double-quotes, square-brakets and grave accents.

- Marcus

markadavies
Contributor III
Contributor III
Author

... so it looks like this is a well known issue.

I have voted as you suggest, have you any idea if Qlik have indicated any intention to look at this?

markadavies
Contributor III
Contributor III
Author

Good idea Marcus,

I have tried it but it does not get around the issue unfortunately

It looks as though there is a well known issue, and trawling the community there are a number of similar queries that are unanswered.

There just is not enough control over the output when using the STORE command, QlikView will encapsulate quotes within another set of quotes wherever it finds them.

marcus_sommer

I'm not sure if you really needs quotes if you used '|' as delimiter - or maybe another unique char which is very unlikely to be within the data (such a other unique char could be also used as a quotes-replacing which in a further processing could be reversed)

- Marcus

markadavies
Contributor III
Contributor III
Author

Unfortunately I do need to include quotes as it is the specification for files that will be imported into a central database.

If I find any work around I will update the thread

Thanks