Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with Peek()

For comparison I need the previous values from 2 fields, but for some reason, peek() and previous() always take the values from the current row, not the previous row:

[Verfahren/Teilverfahren]:
load
Object_ID,
Verfahren,
peek('Verfahren') as Verfahren_Previous,
peek('Object_ID') as ID_Previous
resident Teilverfahren;

Results in:

error loading image

Any ideas??

5 Replies
maneshkhottcpl
Partner - Creator III
Partner - Creator III

Use

peek(recno()<=2,'',peek(ID_Previous,recno()-2)) as FieldName

Not applicable
Author

Hi Manesh,

thanks for your reply, unfortunately this is not working, because recno() counts records for each object_id (I don't know why this happens):

I think that may be the reason why peek() and previous() fails...

Do you know any solution for this?

Thanks in advance!

Not applicable
Author

Hallo Eva,

couldn't believe that your posted script code doesn't work as expected. For that reason I tried it for my own. And it works fine. Take a look at my little exam app. So what are the differences to your app?

Regards, Roland

Not applicable
Author

Hi

try rowno() instead of recno()....

Not applicable
Author

Hi Roland,

the reason must be something with my data-model... I am reading the data from an xml-files and there could be multiple values for one attribute. So QlikView groups the data after the attribute "object_id", so I can only adress the previous rows within that group, that's what I found out so far.