Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Double quotes enclosing some records when exporting to a TXT file

I'm trying to create a text file for import into another system.

There is only one field being exported, one field per row, but some rows are enclosed in double quotes.  I need a clean export without this.

Here is an example, that repeats for each HDR record:

Rec_String

|REC|1|100002-SM-AS|

"|HDR|SM-AS|100002|IC-DRAM-MOD, DDR2, 1GB, 667MHZ, SODIMM|Component|Active|VMI|BUY|gw@sm.com|"

|DET|NA|0|99.5|0|1000|1000|12||0||0|Active|Inactive||

I'm assuming those double quotes are thrown in because of the commas in the text of that field.  This data is constructed in other queries to be exported here, and it is delimited by the "|" character, so I do not need the system to include the double quotes.

How do I get rid of this?

Also, how do I get rid of the field name at the top, "Rec_String"?

Here is the store command I'm using:

Store FD_AS into 'C:\Documents\FD_FD-SM-S02-' (txt); // + year(now()) + Month(now()) + Day(now()) + '1201353535' + '.txt'

The stuff beyond the // is where I was trying to add a timestamp to the file name, but that is blowing up.  So, that would be a third question, how to concatenate those values onto the text.  I'm assuming using the Concat() function.  Not sure how to convert numeric to text right now, or if I have to.

So, three questions:

1) How to get rid of quotes?

2) How to get rid of field name?

3) How to concatenate the timestamp?

The questions are in order of importance.

Thank you.


5 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

1. To get the text delimited with the pipe character you need to change the (txt) output qualifier to (txt, delim is '|'). Then fields containing commas will not be quoted, but fields containing | will be quoted.

2. I don't know any way in QV to prevent the fieldname. You could call a Windows CMD file using a vbscript (or GnuTools) command to strip the leading row.

3. Its blowing up because you are trying to concatenate the string with the wrong operator. Use & instead of +. I would also simplify this be using Timestamp() to format the date field:

     '....FD_FD-SM-S02-' & Timestamp(Today(), 'YYYYMMDD hh:mm:ss') & '.txt'

HTH

Jonathan

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

1)

replace(youronlyfield, chr(34), '')

Not applicable
Author

Well, the "|" character is already in the field.  I'm pulling a fully constructed, | delimited record string from an SQL Server view, and just using QV to export to a file.

I'm seeing the the documentation (which took several clicks to get to) that there are file designators like "fix", and "no quote" which I'm testing now.

That pointer on the & connector is helpful.

Thanks for the response.

Not applicable
Author

I don't believe I can use replace, because the quotes are not in the original field value, but is being created during the store to file.

Not applicable
Author

Doesn't look like it likes FIX or NO QUOTES in that usage.