Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Nissar
Contributor II
Contributor II

Macro Button: ExportChartToCSV from QlikView Dashboard To Any Location

Hi,

I have a QlikView Application with lots of objects, one of them being a straight table.

I have created a macro button called "Generate Invoice File" in the application using the following code in the module:

SUB ExportChartToCSV

SET objChart = ActiveDocument.GetSheetObject("INVOICE")

objChart.Export "C:\Desktop\INVOICE.csv", ","

END SUB

Scripting Engine is set to VBScript

Requested Module Security is set to System Access

Current Local Security is set to Allow System Access

When pressing the "Generate Invoice File" button from my QlikView desktop client, a CSV file is generated on my desktop called Invoice.csv. So far so good.

However, the purpose of this QlikView Application is for the end users in the organization to generate CSV files for their respective customers, through the web-based QlikView Dashoard.

Basically, the end users should be able to press the "Generate Invoice File" button from the web-based QlikView Dashboard, and have a INVOICE.csv generated, but instead of saving it to their desktop or a specific predefined location, I want them to be prompted on where to save the file.

At the moment, even pressing the macro button from the web-based QlikView Dashboard it doesn't do anything, not even creating the INVOICE.csv file on my desktop. But this is less relevant, because I want to get a pop-up on where to save the file.

There is a work around though, where I have to right click on the upper right corner of the straight table, then press export and get a prompt on where to save the CSV file. Is there a way to have a macro button do that?

Br,

Nissar 

Labels (5)
1 Solution

Accepted Solutions
MikeW
Creator
Creator

The web-based AJAX client doesn't support macros. I think you can right click anywhere on the table to export. That's probably the most reliable way to export in AJAX.

If you really want a button... you can look at this option: 

https://community.qlik.com/t5/QlikView-Documents/Useful-Qlikview-Javascript-for-Chrome-Ajax-client/t...

View solution in original post

5 Replies
MikeW
Creator
Creator

The web-based AJAX client doesn't support macros. I think you can right click anywhere on the table to export. That's probably the most reliable way to export in AJAX.

If you really want a button... you can look at this option: 

https://community.qlik.com/t5/QlikView-Documents/Useful-Qlikview-Javascript-for-Chrome-Ajax-client/t...

Nissar
Contributor II
Contributor II
Author

I tried following the example shown in the link you posted, but I am getting an error. 

I have written to the author of that post to see if he can reply.

Thanks for the answer though!

Br,

Nissar

Brett_Bleess
Former Employee
Former Employee

Check out the following Help link, click the Actions link on the right side to jump to that section of the Help, scroll down to the Export action, that should put you the right track for a button export.

https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Button2.htm#anc...

The issue with export in Ajax, is server-side v client-side, you have to use the ExportEx API I believe.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
MikeW
Creator
Creator

The action export only exports a table in the data model, not straight table charts. I don't think it works in ajax either. ExportEx is VB macro and is not supported in Ajax. 

Brett_Bleess
Former Employee
Former Employee

Mike, you are incorrect in your statement that VB macro is unsupported in Ajax, some of the APIs will work, the main issue in Ajax is as I stated previously, if the API is client-side, then it will not work, but if the API is server-side, things will work.

Macros in general should be a last resort in that macros do force a single-thread condition, which causes poor performance, but if that is the only way to do things...  

I do agree, the best option is the caption bar Excel option to do the export, and if everything needs to be CSV, the following setting could be added to the QVS settings.ini within the [Settings 7] section:

RowLimitForCsvInsteadOfXls=x where x is the number of rows, but this will impact the entire environment, so if you want people to be able to do Xls, then modifying this is not likely the right solution either.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.