Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

previous command question

My script looks as follows:

InvoiceLine:

LOAD

      previous([Shipment No_]) as PS,

      peek([Shipment No_])     as PS2,

      [Shipment No_]

FROM

InvoiceLine.QVD

(qvd)

where (Type <> 0);

In the manual I find the following lines:

pprevious command.jpg

The return value of PS2 (the peek statement in my script) is the value from the previous line  and therefore correct.

The return value of PS (the previous statement in my script) is the value from the current line and therefore not correct.

I tried to figure out why the result in my script of the peek command differs from the previous command, but until know I have no idea.

Any explanation is welcome.

Regards,

Gerrit

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Peek() and Previous() have a basic difference when you use a FILTER (where clause) in load. Peek() operates on OUTPUT of source and Previous() operates on INPUT of source. For better understanding please refer this

View solution in original post

3 Replies
tresesco
MVP
MVP

Peek() and Previous() have a basic difference when you use a FILTER (where clause) in load. Peek() operates on OUTPUT of source and Previous() operates on INPUT of source. For better understanding please refer this

christian77
Partner - Specialist
Partner - Specialist

Hi.

Previous refers to the data coming from your DB, data source. Peek refers to the values you already have stored in QlikView data model, with the transformations that you have made.

Peek can be used from any table, any record being -1 the last one, (default), 0 the first record of the table, 1 the second, -2 the before last, -3 the before, before last, etc.

Not applicable
Author

Thanks that makes it clear.