Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.

Evaluate variable in script

I'm trying to look at a table from variable

My set-up


Load * Inline [












[..\Config\For Translation.xls]

(biff, embedded labels, table is UniqueObjectID$);

My Expressions in GUI are


=chr(39)& Language& chr(39)

then for each field:


Which is looking at the table with translation and picking up the right field.

So I will wrap this

LET vHITS:fieldvalue($(vLanguage),25)

so the evaluation will take place at script level?

I'm trying few option but  none is working.

The aim is to have all fields replace with variables from external sources

11 Replies
Honored Contributor II

Re: Evaluate variable in script

No, evalution will take place on the fly,

see the attached example

HTH Peter

Re: Evaluate variable in script

Thank Peter,

This is what I got so far.

So I assume there is no way to evaluate/lookup for the value at script level?

Valued Contributor

Re: Evaluate variable in script

Do this,







[..\Config\For Translation.xls]

(biff, embedded labels, table is UniqueObjectID$);

LET vHit1 = Num(Peek('ID', 0, 'x'));

LET vHit2= Num(Peek('ID', 1, 'x'));

you can use two different variables for the same

Re: Evaluate variable in script

I don't understand your aim and why - what is the benefit? Maybe a short example is helpful.

- Marcus

Re: Evaluate variable in script

If you want to do this at script level, check the Lookup() function. It will do exactly the same thing as your expression, but this time in the script. For example:

LET vHITS = Lookup('$(vLanguage)', 'ID', 25, 'Translation');

But like the other posters, I don't really understand what you're trying to accomplish.


Re: Evaluate variable in script

Not sure what you are trying. Evaluating variable (from GUI) in script? If so, instaed of assign the field selection in variable (using variable definition), try using trigger like in attached sample.

Re: Evaluate variable in script

Thank you all for the input.

I maybe have gone too far:

As this part '$(vLanguage)' must be evaluate before script finished:

looking at the language  table and pick up the right value

and as no selection has been made yet

as we woudl do in GUI:

"EN " selected in List box , expression   (fieldvalue($(vLanguage),25)   evaluates  to field from ID=25)

this is probably no way to do this.

Re: Evaluate variable in script

To put all variables as external sources.,

Re: Evaluate variable in script

Of course there is a way to do this. Make sure that every selection in your languages list box (always a single one I guess) sets a variable vLanguage. Variables will not be cleared if you reload your document so they can be used to pass parameters from the UI to your script. This is a way to load only one language in an otherwise multi-language document (for example by repetitively passing a parameter in the task definition and repeating the reload for every language available)

But it's still not clear what you are trying to accomplish. As far as I know, QV documents work best if they include every piece of information and data that an(y) end-user could possibly be interested in. Not by asking the user what he's up to and then reloading just that bit.

As an example of how this works in an extremely dyynamic way, you could store the preferred language of every user in the SA table, and let QV throw out all irrelevant languages by simple data reduction when the user opens the document.

Or are we on the wrong track here?

Community Browser