7 Replies Latest reply: Jun 30, 2010 8:08 AM by Joachim Rogginer RSS

    Problem with Reload and SaveAs in API


      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")
      rem *** should wait a little bit ***
      qvDoc.SaveAs "NewTest.qvw"

      Thanks very much

        • Problem with Reload and SaveAs in API

          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



          • AW:Problem with Reload and SaveAs in API
            Joachim Rogginer


            qvDoc.SaveAs "NewTest.qvw"



              • AW:Problem with Reload and SaveAs in API

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

                ActiveDocument.ImportLayoutFile ("C:\QlikViewTEST\SourceDocs\HR_SA.layout.xml")
                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.

                  • AW:Problem with Reload and SaveAs in API

                    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.

                    • AW:Re: AW:Problem with Reload and SaveAs in API
                      Joachim Rogginer

                      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" ....

                        • AW:Re: AW:Problem with Reload and SaveAs in API

                          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