Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
juleshartley
Valued Contributor

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....

Tags (1)
1 Solution

Accepted Solutions
MVP
MVP

Re: Strange Peek() behaviour

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.

4 Replies
MVP
MVP

Re: Strange Peek() behaviour

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
Valued Contributor

Re: Strange Peek() behaviour

I'm creating it as follows:

MxDate:

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

MVP
MVP

Re: Strange Peek() behaviour

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
Valued Contributor

Re: Strange Peek() behaviour

Ah yes, I forgot about that! Thanks.

Community Browser