Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

malbordio
Not applicable

Intermitent image export in qlikview

Hello all,

I'm running the following script to load qlikview, reload the file, press a button and automatically close qlikview. I run this on a external vbscript file. It used to run smoothly but recently sometimes it exports all the images to a folder, sometimes it does not. When it doesn't, it gets stuck on the (I think) save part (because I can see it loaded the whole script and there is an * in the file window with the file path). I have macros enabled and security module as system and local module access are granted.

I use this vbs file to load qlikview:

Set MyApp = CreateObject("QlikTech.QlikView")

Set MyDoc = MyApp.OpenDoc ("C:\QlikViewApps\Demo.qvw","","")

Set ActiveDocument = MyDoc

ActiveDocument.Reload

Set Button1 = ActiveDocument.GetSheetObject("BU01")

Button1.Press

MyDoc.GetApplication.Quit

Set MyDoc = Nothing

Set MyApp = Nothing

and inside qlikview > edit module (this is the button BU01) I have:

sub Exportation()

ActiveDocument.ClearAll

for j= 0 to ActiveDocument.NoOfSheets - 1

ActiveDocument.ActivateSheet j

set s=ActiveDocument.Sheets(j)
Objects = s.GetSheetObjects

FOR i = 0 TO uBound(Objects)
SET obj = Objects(i)
obj.ExportBitmapToFile "C:\xampp\htdocs\"& replace(obj.GetCaption.Name.v," ","") & ".png"
next

next

ActiveDocument.ActivateSheet 0

end sub

What do you think it can be? Thanks!

1 Solution

Accepted Solutions
malbordio
Not applicable

Re: Intermitent image export in qlikview

I found the issue.

I was running an external job to fetch excel files and they were being synchronized periodically at the same time they were imported inside the qvw file. The simultaneous process might have caused this while the qvw was reloading. I have fixed it by using a bat to evoque first that excel download job and right after load and run the qvw file. It works perfectly now.

3 Replies
marcus_sommer
Not applicable

Re: Intermitent image export in qlikview

There are different reasons possible. At first the path isn't always accessable and/or valid - maybe there is a blocking from your XAMPP environment or from windows (for example services like shadow copies - further I'm not sure if htdocs is a good folder for this). Also the object-caption could be contain invalid chars like '\'. Also a lack on free storage-space could be a reason.

Further if the security-settings from the modul has changed it will be fail.

I would put a ActiveDocument.WaitForIdle before the exporting-statement and use msgbox or an external logging for this routine - Re: export all objects to ppt - to know exactly what happens and would consider to implement an error-handler (on resume next, query the err.number (skipping, repeating, ...), react on this, on error goto 0).

- Marcus

malbordio
Not applicable

Re: Intermitent image export in qlikview

Thank you for your reply.

I already checked most of those possibilities.

XAMPP is the PHP platorm i am using as a server and in order to publish php/html files. The reason it exports images to that file is in order to publish them and make them available.

I've already checked file/folder permissions and they always have disk space available, so that might not be the reason why sometimes it export, sometimes doesn't. Captions have "legal" characters, or else it would never work either.

In the vbscript I already have a WaitForIdle statement there. Where do you think I can incluse this, exactly? Somewhere in this vbsfile or inside the qlik doc?

I've also included a On Error Resume Next entry. So far, so errors, and intermitency still occurs.

Thanks!

malbordio
Not applicable

Re: Intermitent image export in qlikview

I found the issue.

I was running an external job to fetch excel files and they were being synchronized periodically at the same time they were imported inside the qvw file. The simultaneous process might have caused this while the qvw was reloading. I have fixed it by using a bat to evoque first that excel download job and right after load and run the qvw file. It works perfectly now.