Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

llefever
New Contributor II

clarify how cmdln variable gets used within qvw-file

I'm new to QlikView.  I've just taken over maintenance of a big project from a now-former colleague.

I need to determine how a variable he's setting on the cmdln in a batch-script (using the "/v" option) get's used within the relevant qvw-file, so I can add a variable and set a different dimension similarly.

I see the variable defined (with a static default value) in "Variable Overview", and I see it being used in an expression in "Expression Overview" (not associated with any Sheet, so apparently it's a global variable), but, beyond that, I don't see how any value for that variable (that might be set on the cmdln) get's associated with any dimension or UI-component on the relevant Sheet.

I do see a UI-component (a search component) that set's the value of the dimension that I'm concerned with, based on a value chosen from a list of suggested values, but I don't see there any mention of the relevant variable; so, I don't see how any value set on the cmdln could get set for that dimension, though it seems to be happening somehow.  I don't see the relevant variable mentioned anywhere else, in any of the dialogs in QlikView when the relevant qvw-file is loaded into it.

I don't have any code to show.

So, this is really a general matter of how to use a variable set at the cmdln.  I'm clear about how to set it at the cmdln; I'm just not clear about how to then make use of it within the qvw-file.

Assistance would be much appreciated.

1 Solution

Accepted Solutions
llefever
New Contributor II

Re: clarify how cmdln variable gets used within qvw-file

I've finally found the answer to my own question.

The variable is noted as set within Document Properties => Triggers => OnOpen => Select In Field.

Therein there's a dialog that shows the association between the relevant column and that variable.

I found this by way of triggering a dump of all the configuration of the relevant qvw-file (via creating a directory ending in "-prj" and Saving the file) and doing a text-search throughout the thereby generated files for the relevant variable's name.

The variable is mentioned in a file named DocumentProperties.xml in an element that's a descendant of an element named "OnOpenActionItems".

It seems to me, the only way for a variable specified at the cmdln to filter a dimension while it's not mentioned in an expression is by means of one such OnOpen Action.

7 Replies
Highlighted
wsxedcwsx
Contributor

Re: clarify how cmdln variable gets used within qvw-file

If I understood correctly,  every variable in the qvw is global and is available everywhere . Once you set a value at the cmdln or somewhere else, it can be used in any sheet and any object. But you can not create a variable by cmdln, at first you have to create it in "Variable Overview" or in LoadScript  (LET, SET) SomeVar = SomeValue;

balabhaskarqlik
Honored Contributor

Re: clarify how cmdln variable gets used within qvw-file

llefever
New Contributor II

Re: clarify how cmdln variable gets used within qvw-file

Thanks.  I've seen that document before.  However, it doesn't really show how a (global) variable might be associated with a given dimension.

llefever
New Contributor II

Re: clarify how cmdln variable gets used within qvw-file

Thanks for the feedback.  However, I still don't see how the relevant variable is associated with the relevant dimension.

The variable in question is "rptcust":

qlikview-rptcust-not-associated.png

And the field is "S1CUSTID":

qlikview-rptcust-not-associated-2.png

I see the relevant field (S1CUSTID) in that dropdown in the above screenshot, but I don't see how it's connected in any way to the variable.  None of the dialogs I've opened seem to show any such association.

In the "Current Selections" component on the "Selection" Sheet, I see the S1CUSTID field, with its value set to the value specified on the cmdln.  There's another field, which I see there, that I need to set at the cmdln with a new variable, but I don't see how to associate that field with that other variable.

MVP & Luminary
MVP & Luminary

Re: clarify how cmdln variable gets used within qvw-file

I'm not sure that I understand your description and in your case the variable might be just a dimension.

A variable in Qlik is always global and could contain anything and there are a lot of places in which they could be used. It starts within the script (which is the common place for a cmd-line variable) to macros (did you look in script and macro?) and further to each kind of dimension, expression, condition, color or any statement respectively as part of it.

Beside of this it might be that this variable is out-dated and not adjusted/removed within the cmd by any maintaining-step because their existence is not obvious within the qvw.

- Marcus

llefever
New Contributor II

Re: clarify how cmdln variable gets used within qvw-file

Thanks for the feedback.

I just took another look in the relevant qvw-file, but I again didn't find anywhere where that variable is used, other than in the Variables Overview and the Expressions Overview, and nowhere where its expression is used either.  However, I know it's in use, because passing in a different value for that variable has the intended effect.

Anyway, I've decided I'm going to get the e-book version of "QlikView 11 for Developers" and try to use one or another approach described in it for doing what I need to do; and I expect, at least in the short-term, I'll just leave the existing variable as-is, regardless of how my predecessor managed to make it work.

llefever
New Contributor II

Re: clarify how cmdln variable gets used within qvw-file

I've finally found the answer to my own question.

The variable is noted as set within Document Properties => Triggers => OnOpen => Select In Field.

Therein there's a dialog that shows the association between the relevant column and that variable.

I found this by way of triggering a dump of all the configuration of the relevant qvw-file (via creating a directory ending in "-prj" and Saving the file) and doing a text-search throughout the thereby generated files for the relevant variable's name.

The variable is mentioned in a file named DocumentProperties.xml in an element that's a descendant of an element named "OnOpenActionItems".

It seems to me, the only way for a variable specified at the cmdln to filter a dimension while it's not mentioned in an expression is by means of one such OnOpen Action.