Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a vbs-script which I want to start with a button in QlikView. This is working fine, but now I want to add some Parameter to the script.
In Windows-Shell I can start the script like this
script.vbs Para1 Para2
But how can I add the parameters to QlikView? It is possible to get the parameter in QV from a getfieldselection oder variable?
I tried Parameters but I get an errormessage.
Thank you.
Consider using your vbscript in Edit Module as a macro, and your button action will be "Run Macro". A variable can be used as parameter in this case.
Regards,
Michael
I had to do something similar a while back. Variables cannot be passed in the code from the button. But you can use a preceding action to assign a value to a variable, and then reference the values in variables from within your VB script. As an example, the code below gets the string value from a variable named vObjectID and then strips out the double quotes.
sTableID = ActiveDocument.GetVariable("vObjectID").GetContent.String | |
sTableID = replace(sTableID, """", "") |
Thanks, I will try it this week and tell you how it works.
Lee,
I see the reason of the confusion. I didn't mean "using parameter in the button". I meant use a variable as parameter in the macro. The value of the variable can be set manually in an input box.
If the value of the variable can be set automatically based on some conditions - it can be set in the macro itself instead of an additional action, meaning that parameter not needed at all.
Regards,
Michael
Thanks Michael
That’s a good point, there are many ways that the value of the variables could be set. The macro could also reference values from the current field selections.
I did not thought of qlikview macro, this is a very good idea.
But I get another errormessage when I use the same script in QV (type VBScript, System Access, Allow System Access)
Set Para = wscript.Arguments
QV tells me 'Objekt erforderlich: 'wscript'' (means Object needed: 'wscript') But I think I need this for my parameters
dim Servername
Servername = Para(0)
I think you need to set Module Security to System Access, and Corrent Local Security to Allow System Access - they are in the bottom left part of the window.
thanks, but I did -
(type VBScript, System Access, Allow System Access)
Sorry, wasn't careful 😞
Are you using "option explicit"? If yes, make sure you have "dim wscript".
Also, maybe you don't need "set" here, just
Para = wscript.Arguments
(Just a wild guess, can't tell for sure without seeing the whole picture. And I'm not a VBScript expert.)
I often use msgbox-es in the macro script to debug, helps to see what is going on.