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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to pass variable to lookup function

Hi all,

in the last days I'm working to parametrize lookup function. 

What I need to do is to pass to the function the value of a variable I defined in the document.

In depth, I have a variable GROUP whose expression is '=GRUPPO' : 

     GROUP '=GRUPPO'

What I want to do is to the pass the value of GROUP to a lookup function.

I tried with:

     LET vLang = lookup('LANG','GRUPPO',$(GROUP),'Cono_dati');

or

     LET vLang = lookup('LANG','GRUPPO','$(GROUP)','Cono_dati');

but in both cases, checking on the file log,  the lookup function is not evaluated.

Have you please any suggestion?

Thanks in advance,

Mario

5 Replies
christian77
Partner - Specialist
Partner - Specialist

Hi:

I´m using QV 10 SR2 64 BIT. I can´t find the function LookUp. It is explained in the help page, but it is not longer available, is it?

FunktionList.jpg

Not applicable
Author

Hi Cristian,

the function lookup is available only in the loadscript part of the qvw file.

This is not available instead in Modify Expression Dialog.

I checked this on my QlikView 9.0 version but I think this feature is independent from the version.

Best regards,

Mario

Not applicable
Author

Up!!

Not applicable
Author

At the end, I've not been able to solve this issue.

Actually I'm able to pass the variable value to the function, but when I do that the lookup function is not evaluated.

Infact reading the log, I see the following row:

     Where Column =

Instead of:

     Where Column = '20'

And '20' is supposed to be the evaluation of the following expression:

     LET vLang = lookup('LANG','GRUPPO','$(GROUP)','Cono_dati');

Any other suggestion, please?
Thanks in advance,

Mario

swuehl
MVP
MVP

Hi,

I haven't worked with lookup so far, but

as I understand the lookup function, LANG and GRUPPO must be fields of table Cono_dati, correct?

Then, value of $(GROUP) is evaluated, looked up in field GRUPPO (where a value 'GRUPPO' must exist then) and corresponding value of field LANG is returned, correct?

Have you checked, that table and fields are present on time of evaluation of the lookup function?

If you have just a few lookup values, you might use "pick" to select an expression / value depending on input.

Regards,

Stefan