Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
gussfish
Contributor II

Command-line variable setting not working

Hi Folks,

I'm trying to run a QV10 SR3 QVW from the Win XP command-line, passing in a variable as I do so, but it isn't working as expected and would like your suggestions.

The QVW is attached - it's quite simple, expecting that a variable x will be provided from 'outside', and doing this:

     trace x=$(x);

     LET y=x&x;

     trace y=$(y);


The command-line I'm using is
     qv /r /vx=abc .\test.qvw

The resulting logfile merely displays

     x=

     y=

(whereas I expected

     x=abc

     y=abcabc

)

and the resulting QVW has no variables listed in the  Settings>Variables Overview listing.

I tried using /l (that's lowercase L) instead of /r,perchance it made a difference - but it didn't.

Is there something I'm missing?

Thanks,

Angus.

Tags (1)
1 Solution

Accepted Solutions

Re: Command-line variable setting not working

Hi Angus,

The variables "x" and "y" must exist prior to the reload. Add them empty in the Settings menu, Variable Overview.

The script should use SET instead of LET, without need of concatenationwith the "&". The /v parameter does pass a value to a variable, but if this variable doesn't exist, it does not create it.

TRACE x = $(x);

SET y = $(x)$(x);

//LET y = '$(x)' & '$(x)'; // This will do as well, but seems more complex

TRACE y = $(y);

Hope that helps.

Miguel

View solution in original post

3 Replies

Re: Command-line variable setting not working

Hi Angus,

The variables "x" and "y" must exist prior to the reload. Add them empty in the Settings menu, Variable Overview.

The script should use SET instead of LET, without need of concatenationwith the "&". The /v parameter does pass a value to a variable, but if this variable doesn't exist, it does not create it.

TRACE x = $(x);

SET y = $(x)$(x);

//LET y = '$(x)' & '$(x)'; // This will do as well, but seems more complex

TRACE y = $(y);

Hope that helps.

Miguel

View solution in original post

gussfish
Contributor II

Command-line variable setting not working

Well, how about that - you're right, Miguel!  Thanks.

I hadn't expected that behaviour - in other contexts QlikView will quite happily create variables on the fly, so I'd expected that command-line variables would be created, ready to use.  Seems a bit odd to me, really, but there you go - it's a QlikView thing!

Thanks again,

Angus.

kevinpintokpa
Contributor II

Re: Command-line variable setting not working

Thank you, this stumped me for a while