Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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

Tags (1)
1 Solution

Accepted Solutions
MVP
MVP

Re: previous command question

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

3 Replies
MVP
MVP

Re: previous command question

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
Valued Contributor

Re: previous command question

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

Re: previous command question

Thanks that makes it clear.

Community Browser