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: 
isaiah82
Creator III
Creator III

Export a table from UI as CSV with each field in double quotes?

Hey All ~ I'm wanting to export a table (either a table box or straight table) as a comma delimited text file for integration with another system.

The problem I'm facing is that each field must be quoted, but I'm not seeing this as an option in the QlikView UI.  I also checked the API for Export and ExportEx hoping I could just set up a button, but I don't see any such option there either.

From searching the forum it looks like this may be possible during the load, but I really need to do this from the UI to allow for specific selections that will change.

Am I overlooking something or does anybody have any workarounds?

Thanks -Isaiah

5 Replies
Not applicable

Isaiah

In version 11 you can achieve this with an export action on a button, but i dont think you can do a chart only field values.

I have seen people do some macro's in the community to dump the values of a chart or table but cant seem to find them if you look there are a couple examples. 

Sub ExportToFile

'Download Sheet ojbect data to CSV

set sObject = ActiveDocument.GetSheetObject("TB01")

sObject.Export "C:\download\BIB\TestFile.csv", ", "

http://community.qlik.com/message/115320#115320

As to your formatting problem this may help you package the values, you may have to play a while, where i  I use this to build a list into a variable that I export as a string, that i use to load a table (like a flat file)  I have a more efficient version but i cant find the example

This can be done in one larger nested statement but this is what i have handy:

let vCurVol =replace(Concat('|'&[Sales Code]&chr(39)& ',' & chr(39)& Volume & '|' & chr(13)),'|',chr(39))

Variable Values


vCurVol =

'i','2200'
'i','500'
'i','800'
'ii','1000'
'ii','1700'
'ii','6200'
'iii','1200'
'iii','2300'
'iii','700'

you can replace the chr(39) with whichever chr you like

http://www.roubaixinteractive.com/PlayGround/Binary_Conversion/The_Characters.asp


stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Isiah,

In the past when I have needed to export a file with fixed width fields I have created a straight table with an expression that does a large concatenation to build each line.  The export to file was then triggered from a macro, with the following code:

set sObject = ActiveDocument.GetSheetObject("EXPORTTABLE")

sObject.Export vFullFileName, ""

Because I then needed to remove the header and add a fixed header and footer (with row count in it) I then used the FileSystemObject to load the exported file, string manipulation to remove the column name and append the header and footer rows and then the FileSystemObject to write it out again.

This all feels like overkill for just adding some extra quote marks though.  Did you manage to find a simpler solution?

- Steve

isaiah82
Creator III
Creator III
Author

Thanks Steve ~ your idea is great!

I never found a better solution using any out of the box functionality, so overkill as it may be, it'll have to do.

Much appreciate the input.  -Isaiah

Not applicable

I use:

set obj = ActiveDocument.GetSheetObject("CH02")

"Path\FileName.csv",1

Stephen

Not applicable

Oops every thing did paste in the post above

Stephen

set obj = ActiveDocument.GetSheetObject("CH02")

obj.exportex "Path\FileName.csv",1