Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
ob
Partner - Contributor II
Partner - Contributor II

Exporting images on Server PostReload

We are about to develop a lot of QlikView documents for a customer, version 9. Each document will only reside on the server and contains a macro that should run after reload. The macro produces one or several jpg files to a specified path. This is a small part of the macro in one document:


sub exportGraphToDisc
GraphPath="C:\Graphs"
ActiveDocument.Fields("ML").Select "Something"
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Sheets("Main").ExportBitmapToFile GraphPath & "Graph1.jpg"
end sub


When I reload one of these documents on my PC with QlikView, everything works fine, but on the server it doesn't work. I have been in contact with a QlikTech person and he told me that you CAN launch macros as described above if you tick the "Allow Macro Execution on Server" and "Allow Unsafe Macro Execution on Server" in "QlikView Server Settings". I'm a bit confused, because it doesn't work. Can anyone help?

7 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I'm not sure if this is possible. You want to export a bitmap image, but there is no GUI desktop involved in a Server-Publisher reload, so where would the image be created?

-Rob

ob
Partner - Contributor II
Partner - Contributor II
Author

Yes, I see your point and agree! Technically, how would you solve the following task: A table in the database gets new data once a week and new jpg files should be generated each week to reflect the changes in the table. The jpg files should be placed on a given path to be shown on the company's intranet pages. This should be an automatic job without anyone accessing the QlikView documents.

Thanks

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

First I would mention considering imbedding live Qlikview charts in the web page using some of the techniques shown in the SDK installed with the Qlikview Server distribution.

However, your post specified jpg files, which are static snapshots and are in many cases more useful in a web page. I can suggest a couple of approaches.

1. License the Qlikview Publisher PDF Report component. Put the chart(s) in a report, schedule to write to file, then convert to jpg using ImageMagick or similar utility. I am currently testing this method.

2. Use a external script that does the image exports. You can find such a script in Image_Expoter.zip found at the end of this thread:
http://community.qlik.com/forums/p/16749/95439.aspx

This method has the downside of requiring a desktiop for rendering. You can do this unattended using the psexec utiltity.

-Rob

ob
Partner - Contributor II
Partner - Contributor II
Author

The second approach looks interesting, but with reference to your earlier reply, what about the GUI? Can this be done by QlikView Server or does it require QlikView Developer? The scheduled job will be located on a server!

I'm greatful for you trying to help me in this matter!

Øystein

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP


ob wrote:what about the GUI? Can this be done by QlikView Server or does it require QlikView Developer?


It would require a Qlikview Client for the GUI. When I developed the sample, I used Qlikview Developer. It's possible you could use other clients, like IE plugin, if the document was read from QVS. I haven't tried this.

-Rob

Not applicable

I have a similar scenario, where I have a VBS file that extracts some images. When I run it with my account it does exactly that, but when I schedule it with a windows scheduled task and have it run under some system account it sometimes works, and sometimes doesn't. Any ideas why would it not work sometimes?!

Anonymous
Not applicable

You cannot run a Macro after a publisher reload. Nevertheless you can run a batch reload with the FAT client on the server.

Then the Macro will work. It is also possible to send emails in this way.

Qliktech should allow to execute Macros after a publisher reload.