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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

OnPostReload not performed

Hello all,

I am trying to fire the onpostreload event for a document when the reload is being performed through the command line using the /r switch.

If I do a manual load (clicking the reload icon in Enterprise), the macro associated with the event is executed but through the command line nothing happens. I have specified 'System Access' to the document 'Requested Module Security' and 'Allow System Access' to 'Current Local'. I have also changed the command line to include the /NoSecurity switch.

The attached document gives an example where it tries to write an entry to a log file (creating it if it doesnt exist).

Why does the trigger not fire? Is this a bug in 8.20? What about later versions?

Regards,

Gordon

7 Replies
Not applicable
Author

As far as I know the Onpost reload doesn't work in a batch.

What is working is to create a button running the macro.

Then create a quick vbs batch where you'll open the Qlikview document, then reload then push the button to execute your postreload macro function.

As an exemple of vbs: ( Document name is D:\Qlikview\MyQvwFile.qvw and button name is BU01

Set MyApp = CreateObject("QlikTech.QlikView")
Set MyDoc = MyApp.OpenDoc ("D:\Qlikview\MyQvwFile.qvw","","")
Set ActiveDocument = MyDoc
ActiveDocument.Reload
ActiveDocument.GetSheetObject("BU01").Press

Set MyDoc = Nothing
MyApp.Quit
Set MyApp = Nothing

Hope this help

Rgds

Sébastien

Not applicable
Author

Hi Sebastien,

I wonder why OnPostReload doesnt fire in batch - is this by design or a bug? I need to send an email with an attached chart when the data is reloaded overnight and this sort of requirement must be very common.

Thanks for the information - that is a great workaround to the problem.

Regards,

Gordon

Not applicable
Author

Sebastien,

I just tried the vbs code and although I see the script running, the document is not saved nor is the button 'pressed'.

Do you have any idea what the problem is?

Regards,

Gordon

Not applicable
Author

I'm using post reload macro with execution from a .bat file using the /l (ell) switch. Nothing as complex as email, just saving spreadsheets out. One thing I've run into is forgetting to include the save and close commands in the post reload macro. The qvw will just sit open.

Not applicable
Author

Hello Martin,

So you reload the document through a .bat and a macro is defined for the OnPostReload document event trigger runs?

What version are you running - I thought we had 'proved' that OnPostReload doesnt fire for a batch reload?

Regards,

Gordon

Not applicable
Author

Hi Gordon, sorry for the delay.

Re the macro, did you try to run it step by step ( cscript //X.exe xxx.vbs ?)

Then you can see where it is hanging... Maybe QV is asking you to confirm security macro ?

Running the onpostreload macro didn't work when I launched QV.exe /r flag. Maybe using the /l flag is working ? to be tested, but the /l flag will not save your document after reloading neither closing it ( accordingly to the guide).

Hope this helped you.

Rgds,

Sébastien

Not applicable
Author

Hi ,

I'm tring to execute a export to pdf whit macro using "ActiveDocument.GetSheetObject("BU01").Press"

It work if remove MyApp.Quit from vbs script

if I put MyApp.Quit qv.exe task close before the complete macro execution started by "BU01"

I'm using QLIK VIEW 9 SR3

Set MyApp = CreateObject("QlikTech.QlikView")
Set MyDoc = MyApp.OpenDoc ("D:\Qlikview\MyQvwFile.qvw","","")
Set ActiveDocument = MyDoc
ActiveDocument.Reload
ActiveDocument.GetSheetObject("BU01").Press

Set MyDoc = Nothing
MyApp.Quit
Set MyApp = Nothing