Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Vbs - passing parameters to opendoc or opendocex

Hi everyone,

thanks for all your solutions and good topics of this community.

I have a issue with automating the reloading of qvw with vbs. Indeed, I would like to reload a bunch of apps with a batch script.

Thus, I first used the qv.exe command line with /r and /l arguments but I faced an issue with the progress window that does not automatically close.

So I then found the vbs solution, using the opendocex function which allow a "progress mode" and avoid this progress window. This nicely works, except that I can not find out how to pass parameters to this method (same as /v argument with the qv.exe command line).

I searched my friend google but have not found out the answer. Any idea ?

Thanks by advance for you help.

Romain

1 Solution

Accepted Solutions
marcus_sommer

This worked:

Option Explicit

Dim QA, QD, apppath, param1, newdoc  

apppath = "C:\test.qvw"

param1 = inputBox("param: ")

set QA = CreateObject("QlikTech.QlikView")

set QD = QA.ActiveDocument.GetApplication

set newdoc = QD.OpenDoc(apppath, "","")

      

newdoc.Variables("matable").SetContent param1, true

      

newdoc.ReloadEx 0,1

newdoc.save

newdoc.CloseDoc

QD.Quit   

- Marcus

View solution in original post

7 Replies
Anonymous
Not applicable
Author

1 - Using Publisher

In QlikView QMC-> Users-> Supporting Tasks-> External commands. You could run external commands and pass parameters the same way you schedule a Windows Scheduled task.

2 - ShellExecute command :

- Make sure that you have checked on 'close when finished' on Script Execution Progress window.

- Also you could use window paramter to hide QV to be displayed while reloading ,     Example : http://ss64.com/vb/shellexecute.html

I hope this helps!

MultiView

marcus_sommer

You could the apps treat as object and set hereby any variables you want:

set App = ActiveDocument.GetApplication

set newdoc = App.OpenDoc (Path & Area & arr(i_app),"","")

newdoc.Variables("text_update").SetContent M_all, true

- Marcus

Not applicable
Author

Thank you Multiview and Marcus.

I tried the "object" solution, but unfortunately I got an error :

"Required Object: 'Variables(...)'"

?

oO

marcus_sommer

Your variable is already exists in the called app? Perhaps there is a little error in the syntax ... post your code.

- Marcus

Not applicable
Author

Thank you very much for your assistance Marcus.

This is my code:

Option Explicit

Dim QA, QD, apppath, param1

 

apppath = "C:\test.qvw"

param1 = inputBox("param: ")

set QA = CreateObject("QlikTech.QlikView")

set newdoc = QA.OpenDoc(apppath, "","")

newdoc.Variables("matable").SetContent param1, true

QD.ReloadEx 0,1

QD.save

QD.CloseDoc

QA.Quit

Note that the variable "matable" is declared in my QVW.

marcus_sommer

This worked:

Option Explicit

Dim QA, QD, apppath, param1, newdoc  

apppath = "C:\test.qvw"

param1 = inputBox("param: ")

set QA = CreateObject("QlikTech.QlikView")

set QD = QA.ActiveDocument.GetApplication

set newdoc = QD.OpenDoc(apppath, "","")

      

newdoc.Variables("matable").SetContent param1, true

      

newdoc.ReloadEx 0,1

newdoc.save

newdoc.CloseDoc

QD.Quit   

- Marcus

Not applicable
Author

Got it working! Thanks Marcus.