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

EXECUTING SCRIPT IN QLIKVIEW

Is it possible to run the script from another document Qlikview without opening the document in question?

Thanks

8 Replies
vgutkovsky
Master II
Master II

Yes, you can do this with a macro. You can reference the 2nd QVW and use the Reload routine to run it's script. Alternatively, you can do it via bat using the /r switch, which open the documents, reloads it and then closes it. The macro method doesn't require the document to be opened at all, I believe.

Regards,

Not applicable
Author

Please could you give me an example Sir VLAD.

Not applicable
Author

Please an example using Macro Technic???

vgutkovsky
Master II
Master II

Haha "Sir Vlad," I like that 🙂 Sure, here is an example:


Sub ReloadQVW
Set docObj = ActiveDocument.GetApplication.OpenDocEx ("C:\Documents\myapplication.qvw",0) 'Open the document
docObj.Reload 'Reload the document
docObj.Save 'Save the document
docObj.CloseDoc 'Close the document
End Sub


I was mistaken before--this does open the document first. See the API Guide for more details. So in answer to your original question, I can think of only 1 way to reload a document without opening it. That is by using Publisher. You can also access the Publisher executable and reload via the script. See the QVS Reference Manual, page 241, for more details.

Regards,

Not applicable
Author

Thank you Sir VLAD,

I'm very tired, i will try to execute this ROUTINE tomorow.

And i will make account.

Good Bye Sir VLAD

Not applicable
Author

Good morning,

Please How is the macro is called in my Qlikview script ?

Thanks

Not applicable
Author

Hi,

You can set the macros on the triggers...

Document Properties / Triggers and choose on "Document Event Triggers"

- OnOpen: Select this event to assign an action to be executed each time the QlikView document is opened.

- OnPostReload: Select this event to assign an action to be executed each time the script has been re-executed.

Click on Add Action: Add / External / Run Macro and put the name of your macro in the field.

vgutkovsky
Master II
Master II

You can put this macro in the script using the following syntax:


Sub ReloadQVW
Set docObj = ActiveDocument.GetApplication.OpenDocEx ("C:\Documents\myapplication.qvw",0)
docObj.Reload
docObj.Save
docObj.CloseDoc
End Sub
Call ReloadQVW