Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
gussfish
Creator II
Creator 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.

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

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
Miguel_Angel_Baeyens

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

gussfish
Creator II
Creator II
Author

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
Creator II
Creator II

Thank you, this stumped me for a while