Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to export a table to a text file without extra quotes

I have a table that has a single text field in it. When I export it to a csv file in a version 10 script, for example

store mytable into myfile.txt (txt)

QlikView wraps double quotes around the lines in myfile.txt if there are spaces in the line. Also, if there is a " in the text itself QlikView adds another " next to it.

I would like for the exported text file to not contain the added quotes. I can certainly post-process the text file but I would prefer not to. Does anyone have a solution for this?

Thanks,

Barry

24 Replies
Not applicable
Author

Hi,

The STORE takes exactly same parameters as the LOAD. Make a suitable LOAD using the wizard, and copy the string 🙂

For example:


store * from Fact into [x.txt]
(txt, codepage is 1252, no labels, delimiter is '\t', no quotes)


-----------

As a side note, if one column contains spaces, there will be still qutes in the output file . Use for example good old "tr" command line


tr -d \042 x.txt > y.txt


-Alex

Not applicable
Author

Actually quotes appear inthe output file if the field values contain the separator character. In wich case it is time to choose another separator, or clean up the data.

-Alex

Not applicable
Author

Hi,

I'm also running into this same problem:

I'm using this command:


STORE

From Material INTO $(File) (txt, delimiter is '|', no quotes, msq);

MATNR, MAKTX, MEINS


But the outcome is:

HM200PS|"UNIFLEX HM200 SERVICE CRIMPER 1-1/4"""|PCS


So quotes around the field MAKTX and an extra quote in front of the existing quote.

Originl MAKTX was : UNIFLEX HM200 SERVICE CRIMPER 1-1/4"


Any help would be highly appreciated!

Anonymous
Not applicable
Author

What is the purpose of the txt file? Is it to be loaded into another QV application, Excel or something. If so, remove the quotes during load at that time. If not, post proces the txt file to replace the quotes. I once needed to do and put this together with help from forum:

'...more code above......>>

  set obj = ActiveDocument.GetSheetObject("SAS")

          set pth = ActiveDocument.Variables("vPath")

          obj.Export pth.getcontent.string&"output\clause.txt", 1

' Replace the double quotes from the txt file. Could not find a way to export without??

          Const ForReading = 1

          Const ForWriting = 2

 

          Set objFSO = CreateObject("Scripting.FileSystemObject")

          Set objFile = objFSO.OpenTextFile(pth.getcontent.string&"output\clause.txt", ForReading)

 

          strText = objFile.ReadAll

          objFile.Close

 

          strOldText = Chr(34)

          strNewText = Chr(0)

 

          strNewText = Replace(strText, strOldText, strNewText )

 

          Set objFile = objFSO.OpenTextFile(pth.getcontent.string&"output\clause.txt", ForWriting)

          objFile.WriteLine strNewText

          objFile.Close

PS: vPath is the path variable I define in QlikView.

Not applicable
Author

The purpose is to create a file that can be uploaded into SAP.

I used the suggested workaround, only I created a smal program to do the trick. This is only slowing down the entry process as it basically has to write the file twice.

I also reported it back to QlikView, so let's see if they come up with a solution, basically the 'no quotes'statement shoud do the trick but.....

Thanks anyway!!

Not applicable
Author

Hi,

I reported the fact that the 'no quotes'does work in the store command to the Qlikview team. They have marked it as a bug which will be fixed in one of the next relases

Arend

rbecher
MVP
MVP

Hi Arend,

do you have a bug number for this? When they will fix it?

Can you please make also a note here: http://community.qlik.com/groups/qlikbug

- Ralf

Astrato.io Head of R&D
Not applicable
Author

Ralf,

The ID is 69149. unfortunately I can't post at qlikbug as I don't have have access to it 😉

Arend

Not applicable
Author

Hey!

I had the exact same problem and found this post. Started to make a macro but out of pure luck (trial and error)

I got this to work.

Store ExportTest Into C:\temp\SpacesExport.txt (txt,  codepage is 1252, embedded labels, delimiter is 'spaces' ,no quotes);

The trick is to have the delimiter is 'spaces'  and the spaces word within single quotes.

I want to remove the labels though but havent got that to work. Tried this:

Store ExportTest Into C:\temp\SpacesExport.txt (txt,  codepage is 1252, no labels, delimiter is 'spaces' ,no quotes);

Set it to no labels instead of embedded but QV doesn't pick that up.