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: 
Anonymous
Not applicable

usage of Peek Function

Hi guys,

i have these data

p2.png

I want to fetch  the first value "yaman" by giving the value of key which "Person"

How can i do it using Qlik sense script.

swuehl

stalwar1

diego.a.barboza

1 Solution

Accepted Solutions
sunny_talwar

Sort your table in ascending/descending order of your field ID and then use Peek() function

View solution in original post

11 Replies
sunny_talwar

I want to fetch  the first value "yaman" by giving the value of key which "Person"

Not sure I understand this statement of yours?

antoniotiman
Master III
Master III

May be like this

LOAD Key,FirstValue(Value) as Value
From
Table
Group By Key;

An example :

LOAD Key,FirstValue(Value) as Value Inline [
Key,attribute,Value
Person,Name,Yaman
Person,Surname,Alsaadi
Person,Age,30
Person,Salary,1000
Car,Engine,Crome
Car,Model,2010
Car,Color,Red
]
Group By Key;

sumanta12
Creator II
Creator II

TABLE:

LOAD * INLINE [

KEY,ATTRIBUTE,VALUE

PERSON,NAME,YAMAN

PERSON,SURNAME,ALSAADI

PERSON,AGE,30

PERSON,SALARY,1000

CAR,ENGINE,CROME

CAR,MODEL,2010

CAR,COLOR,RED

];

LET vName=PEEK('VALUE',0,'TABLE');

Anonymous
Not applicable
Author

i mean i  have the value "Person" and i want to know the value of the same row under Value field

sunny_talwar

Is antoniotiman‌ solution not working for you?

Anonymous
Not applicable
Author

it is working just for previous example but if i do not know in which row the key is how can determine the middle parameter in peek function which is the previous example 0

Anonymous
Not applicable
Author

sunny_talwar

What do you mean when you say that you don't know which row the key is? I am not sure I understand the whole logic you are trying to implement here

Anonymous
Not applicable
Author

from the following data :

p2.png

if i have the first ID whixh is 00000000-0000-0000-0000-000000000000 and i want to get the value of the Name which is "Battle"

How can i do it using Peek function but if i do not know the location of this record (only in this example the record in the first row) . i now only the value of ID

so what will be the middle parameter of the peek function !!!