Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

rustyfishbones
Honored Contributor 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?

Tags (3)
5 Replies
mwoolf
Honored Contributor II

Re: Peek function returns the wrong Date

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

Not applicable

Re: Peek function returns the wrong Date

Zero denotes first record of the table.

-1 denotes last record of the table

MVP
MVP

Re: Peek function returns the wrong Date

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

mwoolf
Honored Contributor II

Re: Peek function returns the wrong Date

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

MVP & Luminary
MVP & Luminary

Re: Peek function returns the wrong Date

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

- Marcus