Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

Help in Peek Function

Hi,

I need help in getting the last row using peek function and below is the sample data.

PeekTest:
LOAD * Inline
[
ID
1
2
3
];

LOAD ID,
Peek(ID,0) as FirstValue
Resident Peek;

By using the above peek function i can able to get the first row into FirstValue field i,e, '1' but when i use 'Peek(ID,-1) as LastValue' i'm getting '1' and '2' but i want to see only '3'.

Can someone help me to identify the issue.

Regards,

Bharath Vikas

 

Labels (2)
1 Solution

Accepted Solutions
Highlighted

Do you need Peek() or can this work instead?

Test:
LOAD LastValue(ID) as LastValue;
LOAD * INLINE [
    ID
    1
    2
    3
];

View solution in original post

6 Replies
Highlighted

You want to see just one row with 3 or are you looking to see all three rows with 3 in it?

Highlighted
Master II
Master II

PeekTest:
LOAD * Inline
[
ID
1
2
3
];

NoConcatenate
Final:
Load * Resident PeekTest Order by ID desc;

LOAD ID,
Peek(ID,0) as FirstValue
Resident Final;
Highlighted
Contributor III
Contributor III

@sunny_talwar  I want to see one row with 3.

Highlighted
Contributor III
Contributor III

@Frank_Hartmann  thanks for that, but my requirement is I want first value and last value. It means if i use 'Peek(ID,0) as FirstValue' i want the result as '1' as below

FirstValue
1

 

And if i use 'Peek(ID,-1) as LastValue' i want the result as '3' as below

LastValue
3
Highlighted

Do you need Peek() or can this work instead?

Test:
LOAD LastValue(ID) as LastValue;
LOAD * INLINE [
    ID
    1
    2
    3
];

View solution in original post

Highlighted
Contributor III
Contributor III

@sunny_talwar thanks for that, it works for me and i've modified the script a little bit as below in order to get the firstvalue as well.

Test:
LOAD LastValue(ID) as LastValue, FirstValue(ID) as FirstValue;
LOAD * INLINE [
ID
1
2
3
4
];