Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rustyfishbones
Master II
Master II

Peek function returns the wrong Date

Hi All,

I have following table

Transaction:

LOAD

  warehouse,

    DATE([date-added],'DD/MM/YYYY') AS Date

FROM

(qvd);

LET vMaxDateTime = Peek('Date',-1,'Transaction');

However the variable is not returning the correct date

It should be returning 29/05/2014 but it keeps returning 26/09/2013

Any ideas?

5 Replies
m_woolf
Master II
Master II

What makes you think the it should be returning 29/05/2014?

Not applicable

Zero denotes first record of the table.

-1 denotes last record of the table

tresesco
MVP
MVP

Were the dates sorted when stored in qvd? Are you looking for max date? If so, try like:

Load

          Max([date added]) a Maxdate

From <>;

LET vMaxDateTime = Date(Peek('Date'));

m_woolf
Master II
Master II

Why don't you display the records sorted by load order to verify the contents of the last record?

marcus_sommer

If you looked for the max(Date) this could be an alternatively: “Fastest” Method to Read max(field) From a QVD | Qlikview Cookbook.

- Marcus