Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with Reload and SaveAs in API

Hello,
we have written a little VBS-file to reload QlikView-documents from outside. It seems that QlikView gives the program sequence back to the calling VBS-script directly after ending the QlikView script. But the Reload didn't finish updateing the visual controls. So the following Save command crashes (QlikView does not do anything more. It's only possible to kill the process by task manager). When we do the same but the visible Sheet is empty (no time consuming controls on it) everything works fine. Now my question is: Is there any status in the document which gives us a hint when the reload has refreshed the controls too?

Here is the little VBS:


set Qv = CreateObject("QlikTech.QlikView")
Set qvDoc = Qv.OpenDoc("Test.qvw","Admin","1234")
qvDoc.Reload
rem *** should wait a little bit ***
qvDoc.SaveAs "NewTest.qvw"
qvDoc.CloseDoc
Qv.Quit

Thanks very much
Michael

7 Replies
Not applicable
Author

I am having a similar issue - but only where the qvw is particularly large.

For example where teh .qvw is around 500K it goes past a breeze, where the .qvw is 20 or so megs it stops and just highlights the line in the macro and stops there.

I tried waitforidle and sleep before the saveas command, but to no use...

Any help appreciated

Simon

biester
Specialist
Specialist

try:

...
qvDoc.Reload
Qv.WaitForIdle
qvDoc.SaveAs "NewTest.qvw"
...

Rgds,
Joachim

Not applicable
Author

I tried this but now it stops on the 'WaitForIdle' - part of script beow

ActiveDocument.ImportLayoutFile ("C:\QlikViewTEST\SourceDocs\HR_SA.layout.xml")
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.SaveAs "C:\QlikViewTEST\SourceDocs\HR_SA.qvw"

I have a batch file that calls this qvw -

"C:\Program Files\QlikView\qv.exe" /l /NoSecurity "C:\QlikViewTEST\SourceDocs\HR_SA_Reload.qvw"

which basically just loads the new layout xml and spits out the new qvw to roll to live.

Not applicable
Author

i did furtehr tests - this time I added a msgbox to popup after xml load - and that doesn't happen either... the weirdest thing is that exactly the same macro for a smaller xml doc works fine. The threshold seems to be around 2mb in my case.

biester
Specialist
Specialist

Did you create the layout.xml manually or by macro? Fact is that ActiveDocument.ExportSheetLayoutFile does not create correct Layout-XML-files. This is proposed as bug 27751. Thus I could imagine that the macro stops at "WaitForIdle" ....

Not applicable
Author

Hi biester - firstly thank for your help Smile

The xml is created by another macro yes - and its an 'export document layout' not 'export sheet layout' i.e. I use ''ActiveDocument.ExportLayoutFile''- will I have the same issue?

I also tried to use an xml file i created manually - and I still get the same prob unfortunately.

I am intrigued by why it works for a smaller xml (If you want I can send you qvw set that works and the qvw set that doesn't - the macros are identical ) - is there any memory setting I might tweak? It looks to me that the problem is that while the layout xml is loading it goes onto the next line and crashes, whatever the line is.

thanks again

Sim

biester
Specialist
Specialist

Well, if it's the same with manually created XML files I'm afraid I'm running out of ideas. In fact I don't think it's a mere memory problem. Have you tried the same on another machine? Does it work when you manually import the manually exported XML? Anyway, perhaps another bug, I would contact support.

Rgds,
Joachim