Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set variable value from command line using "/v"

I am trying to test out the ability to pass a variable and value from the command line using the following:

"C:\Program Files\QlikView\QV.exe" /r /vParameterTest=1234 "C:\Desktop\QVW_QW\PatternTrending\reports\PatternTrending.qvw"

In my scripts tab, i declared a variable called "test" that is assigned the value from the passed in variable - "ParameterTest" so that I can then display that value on a text object to see if the value was passed in correctly but it is null.

Set test = ParameterTest;

Any help, please?

17 Replies
Gysbert_Wassenaar

"C:\Program Files\QlikView\QV.exe" /r /vParameterTest=1234

This will assign the value 1234 to the variable ParameterTest. If you want to assign the value 'ParameterTest' to a variable called test then you need:

"C:\Program Files\QlikView\QV.exe" /r /vtest=ParameterTest


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

For your text object give it the expressions of :

     = $(ParameterTest)

That should display 1234 & if so then you should be ok.

I am not sure you actually need the other variable called "test".

Not applicable
Author

Right, I understand that it will assign the value 1234 to the variable ParameterTest. Since I read that you can only use variables passed in from the command line in your script or macro function, I created another variable called "test" so that I can assign the value from ParameterTest and display the value in a text object on the GUI.

My text object value is set as:   "=test"

Anonymous
Not applicable
Author

Yup , it is the dollar expansion you need.

Gysbert_Wassenaar

Since I read that you can only use variables passed in from the command line in your script or macro function

That's not correct. There's only one kind of variable. If you have a variable you can set its value from the command line, or in the script (with the SET and LET statements) or in the Variable Editor or with actions assigned to triggers. The variables can be used in the script and in expressions in chart objects etc. So you don't need to create another variable to get the value from a variable that got its value via a command line option.


talk is cheap, supply exceeds demand
Not applicable
Author

I actually tried that before too but no luck. I tried it with and without the enclosed $(). Just tried it again but no dice.

Anonymous
Not applicable
Author

So did you use = $(ParameterTest) as the expression in your Text Object ?

Not applicable
Author

Here's what I have and not working.

Anonymous
Not applicable
Author

In Settings | Variable Overview what does it show for your variables ?