Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Windows Scheduler + Printing macro after reload = terminates w/h printing?

Hi all,
- I have created a macro that prints a report named "PR01" = Works
- I have created a scheduled task in windows to open a QV document and reload it. = Works
- I then do a Trigger that is said to be executed after the document has reloaded. = This works if I do it myself within Qlikview but when I run the scheduler it seems to be crashing giving no error message.

I can see the scheeduler reloading the qv document then the print screen pops up and then it just disapears but the scheduler keeps running in the background.

If I change the macro to start BEFORE the reload it works with the scheduler. This makes me think it tries to terminate before the document has had enough time to print the document, but how if so do I stop this from happening? can I pause the macro and buy the printing some time?

Trigger:
error loading image


error loading image


Kind Regards,

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Here is a simle example (not tested, may be not clean):


sub OnOpen
set v = ActiveDocument.Variables("PrintReport")
if v.GetContent.String = 1 then
ActiveDocument.PrintReport("RP01")
end if
v.SetContent 0, true
end sub


View solution in original post

4 Replies
Anonymous
Not applicable
Author

Not applicable
Author

Thanks Michael,
Now I get what i have to do but I get stuck on how the macro should look like to check the current value in the variable. Could you help with a sample?

This is how it currently looks like:

Sub PrintMyReport()
ActiveDocument.PrintReport("RP01")
ActiveDocument.GetVariable("CreateReports").setContent 0, false
End Sub

Trying to use the API guide but wow man; I dont even get why it would be "false" in the statement above - so thats how deep out I currently am.

Anonymous
Not applicable
Author

Here is a simle example (not tested, may be not clean):


sub OnOpen
set v = ActiveDocument.Variables("PrintReport")
if v.GetContent.String = 1 then
ActiveDocument.PrintReport("RP01")
end if
v.SetContent 0, true
end sub


Not applicable
Author

Thanks a whole lot Michael!