Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I know how to read a QVD and export it to a CSV. But how would I go about adding double quotes to my
field data? For example, say my QVD contains 3 columns. First name, last name and street. I want the content of
my CSV file to look like this:
"JOHN", "DOE", "123 ABC STREET"
Thank you
I used the same syntax as yours.
Can you actually post your app? Because your screenshots may not reflect the true state of your problem.
Hi sidneylu,
try using
chr(96) & chr(34) & Timestamp(TransactionPostDate) & chr(34) as 'TransactionPostDate2',
Best regards
Andrea
Andrea,
It did not work. It produced this format with a single tick on the "left".
"`""7/1/2011 12:00:00 AM"""
Sidneylu,
wich version of excel do you have ?
Are you sure that in the excel is not defined a macro that changes the content of a cell ?
something like this:
Public Sub QuoteWrap()
Const q = """" 'double the double quotes
Dim ws As Worksheet
Dim rCell As Range
For Each ws In ActiveWorkbook.Worksheets
For Each rCell In ws.UsedRange
If Not IsEmpty(rCell) Then _
rCell.Value = q & rCell.Value & q
Next rCell
Next ws
End Sub
Hi anlonghi2
Excel is not involved.
I'm simply loading a QVD file and storing it in a CSV file. After the CSV file is generated, I open it with
TextPad which is just a text editor to see the content as you can see from the screenshot I posted earlier.
This is really strange. Is there any setting I need to look? I am new to Qlikivew.
I just created this at home. I'm experiencing the same issue.
Can someone use the below, try it and post your result? I'd be curious to find out.
contact:
LOAD
chr(34) & fname & chr(34) as 'fname1',
fname,
lname
FROM
C:\Qlikview\Test.txt
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);
store contact into C:\Qlikview\contact.csv (txt);
//Test.txt
fname,lname
john,doe
//contact.csv
fname1,fname,lname
"""john""",john,doe
The store statement only generates quotes when the data contains something (like quotes) that should be quoted according to the MSQ quoting rules. So when you include the dquotes in your data, you trigger the quotes.
If your data is seen as not needing quotes, they don't get generated.
It's been a long standing request to have more control over output options in the Store statement. I feel your pain.
-Rob
There is no easy way to do this - QV is not designed as a data export tool, so although you can set the field delimiter, the txt/csv export is only done with standard quoting - fields that do not include the delimiter, or quote marks are not quoted, field values that contain the delimiter or quotes are quoted.
The easiest way is to do this in post processing with a text processing tool like sed (available as part of the GnuWin32 tool set), or with a powershell script.
Hi Sidneylu,
please try the following approach.
TabletoExport:
LOAD MyFirstName & ',' & MyLastName & ',' & MyAddress as mystring;
LOAD
chr(34) & [First Name] & chr(34) as MyFirstName,
chr(34) & [Last Name] & chr(34) as MyLastName,
chr(34) & [Address] & chr(34) as MyAddress
FROM
PEOPLE.csv
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);
store * from TabletoExport into Myexport.csv (txt);
Best Regards
Andrea