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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
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
Not applicable
Author

Null

Anonymous
Not applicable
Author

Aaahh !!  So you have nothing in your variable ParameterTest

I usually pass the parameter in at the end of the command, as in :

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

*****************

Or does something later in your script reset the variable ?

Not applicable
Author

? The variable is showing null as it's value after running the command line. I am not defaulting it to anything, I am relying on having it set by the command line.

I don't think the ordering matters (maybe), as you show in your command line example but I gave it a shot and still did not work for me.

Anonymous
Not applicable
Author

Can you post your qvw ?

Not applicable
Author

Unfortunately, the firewall at work will prevent me from doing so.

Can't believe this is not working for me and for something so simple taking forever to get working. I am running this simple test so that eventually I can pass in 2 variables, 1 would be a Trading Exchange name and the other a database connection properties file as I have to load data from 2 different Trading Exchanges having the same tables that are structured the same. I want to set it up as 1 QVS import script for both Exchanges so that it dynamically query the data into seperate qvd files (ie. C1_quotes_data.qvd, C2_quotes_data.qvd) and then have my main application concatenate the 2 qvds into 1 (ie. quotes_data.qvd) to use as the source for the reports.

Anonymous
Not applicable
Author

I have just tested it by creating a new qvw with this in the load script

trace $(ParameterTest) ;

set vCheck = $(ParameterTest) ;

trace $(vCheck) ;

Via Settings / Variables manually created blank variable ParameterTest

Called it like this

C:\Users\bill.markham>"C:\Program Files\QlikView\QV.exe" /r /vParameterTest=qwerty C:\Users\bill.markham\Downloads\ParameterTest.qvw

And got this in the log file:

03/11/2014 18:08:36: 0013  trace qwerty

03/11/2014 18:08:36: 0013  qwerty

03/11/2014 18:08:36: 0015  set vCheck = qwerty

03/11/2014 18:08:36: 0017  trace qwerty

03/11/2014 18:08:36: 0017  qwerty

03/11/2014 18:08:36:      Execution finished.

That all seems ok, could you try those steps ?

Not applicable
Author

This morning, I turned on the logging and reran the command line execution (without yet trying your example above). The darn thing works now for some reason! I tried turning off the logging to see if it would still work and it does. I didn't make any other changes today before that.

Another strange thing is that for my text box source, i had "=$(ParameterTest)", it was displaying the value ok for a few runs and then it was displaying null again all of a sudden for subsequent runs. I went to Settings -> Variable Overview, and i saw that the value was being correctly set even though it was displaying null. I changed my text box source to "=ParameterTest" and now it is working consistently.

Weird.

Not applicable
Author

Thanks all for the help! Much appreciated.

After getting my test working, I am now able to do what I was ultimately trying to do - to run the same scripts for 2 different databases containing data for 2 different trading exchanges (having the same table structures), creating a separate set of qvd files for both databases and then merge them into 1 qvd file.