Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Kushal_Chawda

Difference Between peek() and previous() function?

Hi All,

Can you tell me what is differencr between peek() and previous() funcion in detail?

Regards,

kushal

3 Replies
Miguel_Angel_Baeyens

Hello Kushal,

Search a bit in the forums and you will find some useful information about that, in addition to check the Reference Manual.

Anyway, the difference is that Peek() refers to any value already loaded in the record specified, whether it's the previous value for the field, or any other. Previous() only refers to the immediately previously loaded record.

Check this post to see a working example of Peek() and Previous().

Regards,.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

Jason_Michaelides
Luminary Alumni
Luminary Alumni

Kushal,

The F1 help explains this very clearly. Without the second parameter, Peek() is the same as Previous().

Jason

swuehl
MVP
MVP

Hi Kushal,

In addition to above postings (and to the always helpful links to existing help functions / pages) I want to add a difference between peek and previous (but no more than I can get from the Help also):

While previous evaluates an expression in the context of the previously loaded record (but note that you may use nested previous statements) and this context is still the input record, before restricting to the fields stored in the associated DB, peek is more like a lookup function to return the value of a given field and index, where you only can adress the fields stored in the associated DB.

So, depending on your expression, peek() and previous() may differ also when used with only one parameter (more precisely, you can't even use peek with an expression, you specify a fieldname).

Regards,

Stefan