Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

How to fix problems with Peek in the script?

Hi, I'm trying to use the peek function in the script. Basically I have one value in the first month and I want to populate this down.

The issue peek function is having some aleatory issue and I cannot have this visible down.

The expression is the following =

if(isnull(DataPrice),  Peek (DataPrice), DataPrice) as PricePeek,

ordered by Date

Please see below the expected results:

5-08-2014 11-48-05 AM.png

The files with the script are enclosed.

Thanks in advance, Leadro

Tags (1)
1 Solution

Accepted Solutions
Not applicable

Re: How to fix problems with Peek in the script?

As suggested by Ioannis.

6 Replies
giakoum
Honored Contributor II

Re: How to fix problems with Peek in the script?

try

if(isnull(DataPrice),  Peek (PricePeek), DataPrice) as PricePeek,

dfoster9
Valued Contributor

Re: How to fix problems with Peek in the script?

Peek does not work that way. You might look at Previous.

My suggestion is that what you do is:

  1. Read the month start records from the file into a mapping table.
  2. Load the full table using APPLYMAP to return the matching monthstart values.
Not applicable

Re: How to fix problems with Peek in the script?

As suggested by Ioannis.

mwoolf
Honored Contributor II

Re: How to fix problems with Peek in the script?

peek expects the field name  to be a string.

Try:

peek('DataPrice')

Also peek will return null on the first record.

dfoster9
Valued Contributor

Re: How to fix problems with Peek in the script?

Isn't the price wrong for Supplier A?

Not applicable

Re: How to fix problems with Peek in the script?

For supplier A per logic 2000 gets applied where ever there is a null. not sure what the desired output should be though.

Community Browser