Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Tell us which business and trade publications you read most regularly: RESPOND NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
yamananalytic
Creator II
Creator II

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');

yamananalytic
Creator II
Creator II
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?

yamananalytic
Creator II
Creator II
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

yamananalytic
Creator II
Creator II
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

yamananalytic
Creator II
Creator II
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 !!!