Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
grant_S
Contributor
Contributor

how to get specific row value base on a keyword?

 

T1:
load * Inline [
ID,age
A,22
B,33
C,44
D,55
E,66
];
//actually in table T1, there are a lot of rows, here only give simple example,

//I want to get specific row value ,such as ID='E', get its age and put to variable a,
//I don't know the row number of ID 'E', so I cannot use peek('ID', rowNumber)

let a = ???

 

thanks advanced.

 

 

------------------------------------------------------------------

I did it like this but I'm not sure whether there is a easy method to do that.

test:

load age resident T1 where ID='E';

let a = peek('age',0);

drop table test;

 

it takes too many steps, 

who knows whether there is a easy way to do that? just one step?

1 Solution

Accepted Solutions
marcus_sommer

Maybe this will be useful:

let a = lookup('age', 'ID', 'E', 'T1');

- Marcus

 

View solution in original post

2 Replies
Taoufiq_Zarra

@grant_S  at any time you can use :

T1:
load * Inline [
ID,age
A,22
B,33
C,44
D,55
E,66
];

Temp:

Load

               ID  as IDtmp,

               age as agetmp

Resident T1 where Match(ID,'E')>0;

Let varID = Peek('IDtmp', 0, 'Temp');

Let varAge = Peek('agetmp', 0, 'Temp');

DROP Table Temp;

output in debeug

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
marcus_sommer

Maybe this will be useful:

let a = lookup('age', 'ID', 'E', 'T1');

- Marcus