Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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

1 Solution

Accepted Solutions
Not applicable
Author

As suggested by Ioannis.

View solution in original post

6 Replies
giakoum
Partner - Master II
Partner - Master II

try

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

DavidFoster1
Specialist
Specialist

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
Author

As suggested by Ioannis.

m_woolf
Master II
Master II

peek expects the field name  to be a string.

Try:

peek('DataPrice')

Also peek will return null on the first record.

DavidFoster1
Specialist
Specialist

Isn't the price wrong for Supplier A?

Not applicable
Author

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