Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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:
Kind Regards,
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
Take a look here
http://community.qlik.com/forums/p/16762/65586.aspx#65586
maybe it will help.
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.
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
Thanks a whole lot Michael!