Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

jrbrutto
New Contributor II

Peek as expression

Hi,

New using Peek and I found a problem with that:

Using variables (Peek1 attachement) result is not populated

Using hardcoded values (Peek2 attachment) result is populated correctly

Any suggestions? Thanks

 

 

Labels (1)
1 Solution

Accepted Solutions
jrbrutto
New Contributor II

Re: Peek as expression

I tried all possible mix with quotes and no-one works

Let vStation= peek($(vStationTableField),$(k),$(vStationName))

Let vStation= peek('$(vStationTableField)',$(k),$(vStationName))

Let vStation= peek($(vStationTableField),$(k),'$(vStationName)')

Let vStation= peek('$(vStationTableField)',$(k),'$(vStationName)')

At the end I found as acceptable solution the following

// PEEK DATA FROM STATIONS
LET variablea = Peek('TABLE_FIELD_A',$(k),'TABLE_STATIONS_A');
LET variableb = Peek('TABLE_FIELD_B',$(k),'TABLE_STATIONS_B');
LET vresult = if(n = '1', variablea , if(n = '2', variableb )); 

7 Replies
pradosh_thakur
Honored Contributor II

Re: Peek as expression

Try

Let vStation= peek($(vStationTableField),$(k),$(vStationName)); // I have deleted the ' as the output already has it
if this doesn't work send the screenshot for the below
let v1 = '$(vStationName)';
let v1 = '$(vStationTableField)';
Learning never stops.
jrbrutto
New Contributor II

Re: Peek as expression

Hi Tried but is doesn't works.

Attached you can find fields values.

I ran two times one with our solution and one with fields values hard-coded.

When it's used as variables vStation result fail (NULL), when it's used hard-coded it works perfectly.  

 

pradosh_thakur
Honored Contributor II

Re: Peek as expression

hi

if you see carefully your $(vStationTableField) already has single quotes. You should not use it inside the peek expression. so may be try to not use single quotes in the expression of the variable itself.

peek(field name_without single_quotes,$(k),table_name_in_single_quotes)

can you please write the expression of both the variable.
Learning never stops.
jrbrutto
New Contributor II

Re: Peek as expression

Hi,

Attached you can find peek without quote but it doesn't work either.

 

jrbrutto
New Contributor II

Re: Peek as expression

Hi,

Attached you can find peek without quote but it doesn't work either.

 

pradosh_thakur
Honored Contributor II

Re: Peek as expression

I guess you didn't understand me. Can you just write the expression for vStationTableField and vStationTable for me. I will change a couple of things and you can try that

Please try the above in an extra app and not the main app itself.
Learning never stops.
jrbrutto
New Contributor II

Re: Peek as expression

I tried all possible mix with quotes and no-one works

Let vStation= peek($(vStationTableField),$(k),$(vStationName))

Let vStation= peek('$(vStationTableField)',$(k),$(vStationName))

Let vStation= peek($(vStationTableField),$(k),'$(vStationName)')

Let vStation= peek('$(vStationTableField)',$(k),'$(vStationName)')

At the end I found as acceptable solution the following

// PEEK DATA FROM STATIONS
LET variablea = Peek('TABLE_FIELD_A',$(k),'TABLE_STATIONS_A');
LET variableb = Peek('TABLE_FIELD_B',$(k),'TABLE_STATIONS_B');
LET vresult = if(n = '1', variablea , if(n = '2', variableb ));