Qlik Community

QlikView Documents

Documents for QlikView related information.

Peek() vs Previous() – When to Use Each

Employee
Employee

Peek() vs Previous() – When to Use Each

This zip file contains a technical brief, a qvw and a small file. The technical brief walks the user through the steps of when to use peek() vs previous() functions. I published a blog about it as well. You can fiund the blog here.

Labels (1)
Attachments
Comments
danieloberbilli
Valued Contributor II

Chuck, thank you so much for sharing this intersting brief! Unfortunately there is password needed to extract the zip-file...

Kind regards

Daniel

Gabriel
Valued Contributor II

Hi All,

This blog is a very good example of using Peek() & Previous() function in QV.

Just a note of caution. If you are following the example in the QlikView Technical Brief - Peek() vs Previous.docx file in the  zip file.

When you have created the app (scripting), if you view the table (ctrl + T) you will find synthetic key and a 3rd table in your Data Model. It might be helpful to remove the 3rd table.

Now to remove this.

Drop Table [Employees Init] ;

Hope this is helpful.

Best Regards,

Gabriel.

MVP
MVP

Hi Charles,

thanks for your post and document. But, I think you're mixing things in the Summary instead of clarifying:

"..the Peek() function allows the user to look into a field that was not previously loaded into the script whereas the Previous() function can only look into a previously loaded field."

Previous from Help:

The previous function may be nested in order to access records further back. Data are fetched directly from the input source, making it possible to refer also to fields which have not been loaded into QlikView, i.e. even if they have not been stored in its associative database.

You can easily demonstrate this with a Where clause:

LOAD F1, F2, Peek(F1) as PeekVal, Previous(F2) as PrevVal Where F2 >= 200;

LOAD * INLINE [

    F1, F2

    A, 100

    B, 200

    C, 150

    D, 320

];

- Ralf

Not applicable

helpful answer

raajaswin
Contributor III

Helpful

nihhalmca
Valued Contributor II

good post.

cata_pli
New Contributor II

Hi,

Does anyone has any idea why at reload it says "73 lines fetched", since there are only about 27 rows in the table ? If you go into "preview table" we can even see the rest of the empty lines.

I have also tried it in Qlik Sense and it says the same.

Thank you.

qlikview_yj
Contributor

Helpful

Version history
Revision #:
1 of 1
Last update:
‎04-08-2013 09:11 AM
Updated by:
Employee