Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I have a problem which have bothered me for awhile.
I have a Dashboard which I save as a png file and save it to a path. This Works, but it fails randomly during the day. If I'm Lucky it could Works 24 hours, but sometimes it fails 2 times in 10 min.
The logfile says Execution finished, script runs to the end but then something happens. This Message shows up and the Application need to be restarted.
This is the code that I use in edit module:
Sub RefreshData
'Reload new data
ActiveDocument.ReloadEX 0,1
'Export sheet
ActiveDocument.GetSheetByID("SH02").Activate
ActiveDocument.GetApplication.WaitForIdle 1500
ActiveDocument.GetSheetByID("SH02").ExportBitmapToFile "\\10.1.1.1\xxx\xxx\xxx\pic.png"
ActiveDocument.GetApplication.WaitForIdle 3000
ActiveDocument.Save
End Sub
I have try to export to local path C:\temp but still same problem.
Use WaitForIdle without milliseconds!
Sub RefreshData
'Reload new data
ActiveDocument.DoReload 2,false,false
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.Save
ActiveDocument.GetApplication.WaitForIdle
'Export sheet
ActiveDocument.GetSheetByID("SH02").Activate
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetSheetByID("SH02").ExportBitmapToFile "c:\temp\pic.png"
End Sub
Thanks Christian,
I'll change and do a test.
What is the different between ActiveDocument.DoReload 2,false,false and ActiveDocument.ReloadEX 0,1?
Description in QlikView API Guid:
DoReload:
Executes the script. This is a more modern version of the old Reload member. The old Reload will continue to work for most applications.
Seams like theese two are the same, no script window is shown during the reload.
The progress dialog during reload you can see only with ReloadEx:
ActiveDocument.ReloadEx 2,2
Hi Christian,
The milliseconds seams to cause the problem that I have, I have now run the Application during the night and no issue at all. Do you know why these milliseconds are "bad"?
After the milliseconds, the macro is continued regardless of whether the idle state has already been reached or not. For example, you can not export the chart before it is finished. Before such actions you have to wait for the idle state how long it will take. It needs a WaitforIdle after Reload, Save, Activate, ...
Many Thanks Christian,
I hve tested so many Things here but not "deleted" the milliseconds. I have rather increase the milliseconds to get rid of the problem.