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: 
juleshartley
Specialist
Specialist

Strange Peek() behaviour

Hi All,

Can anyone explain this!

I have a table loaded as below

MxDate

43008

42978

42916

If I put this field in a list box and sort by 'load order' and show frequency I only have single values in the order shown above.

I have lines in my scrips as below:

let vRepDate = Peek('MxDate', 0);

let vRepDatePrior= Peek('MxDate', 1);

This returns vRepDate = 43008 (correct)

but vRepDatePrior = 42916 !!

I don't understand....

1 Solution

Accepted Solutions
swuehl
MVP
MVP

The DISTINCT qualifier can mix up your output table rows, so the resulting MxDate table is not sorted in descending order ( the order by clause is only affecting the Input table).

Have a look at the table view table preview to see what I am talking about.

View solution in original post

4 Replies
swuehl
MVP
MVP

I can't reproduce this behaviour with the Information provided.

LOAD * INLINE [
MxDate
43008
42978
42916
]
;
 
let vRepDate = Peek('MxDate', 0);
 
let vRepDatePrior= Peek('MxDate', 1);

How is your field MxDate created?

juleshartley
Specialist
Specialist
Author

I'm creating it as follows:

MxDate:

Load Distinct Num(Date) as MxDate Resident Performance order by date desc;

swuehl
MVP
MVP

The DISTINCT qualifier can mix up your output table rows, so the resulting MxDate table is not sorted in descending order ( the order by clause is only affecting the Input table).

Have a look at the table view table preview to see what I am talking about.

juleshartley
Specialist
Specialist
Author

Ah yes, I forgot about that! Thanks.