Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to use a varibale in peek?

Hi

I was trying to follow some other post of how to generate a random value to check but I can´t get the variable to work. Can some of you se what I´m doing wrong?

/Thanks

(http://community.qlik.com/thread/61424?tstart=30)

Load:

KKIK:

KKIK_Key,

ID,

....

From...

 

LET RandomRow = round(Rand()*(NoOfRows(KKIK_Key)));

KKIK_RandomCheck:

LOAD

peek('KKIK_Key',$('RandomRow'),'KKIK') as KKIK_Key,       

peek('KKIK_Key',$('RandomRow'),'KKIK') as KKIK_Random_ID

//peek('KKIK_Key','1','KKIK') as KKIK_RandomCheck_ID        <---- This works, gives me a id to check on

AutoGenerate 1;

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Have you tried

peek('KKIK_Key',$(RandomRow),'KKIK') as KKIK_Key

edit:


and check also the variable created, I think I would use something like

LET RandomRow = floor(Rand()*(NoOfRows('KKIK_Key')));

View solution in original post

3 Replies
swuehl
MVP
MVP

Have you tried

peek('KKIK_Key',$(RandomRow),'KKIK') as KKIK_Key

edit:


and check also the variable created, I think I would use something like

LET RandomRow = floor(Rand()*(NoOfRows('KKIK_Key')));

whiteline
Master II
Master II

My fault with round(), thanx.

Not applicable
Author

Hi. Sorry for late replay but was gone for the weekend. Thanks for the help!