Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem on peek() function

Hi there Qlikview addicts,

I have encountered an unexpected behaviour on my peek function. Allthough the fields testing 1 and testing 2 are calulated correctly my field of testing 3 gives me an error on OATimestamp('Field not found').Can anyone help??? I have attached my code below.Thanks in advance.

OperatorActivity:

LOAD

          sessionID,

          user,

          activity,

          activityID,

          timestamp as OATimestamp,

          peek(sessionID),//testing 1

          peek(OATimestamp) as PastTimestamp,//testing 2

          if(peek(sessionID)=sessionID,dayStart(timestamp(peek(OATimestamp)))-dayStart(timestamp(OATimestamp)))as TimestampDiffTest;//testing 3

SQL SELECT

                    oa.sessionID,

                    oa.user,

                    oa.activity,

                    oa.activityID,

                    oa.timestamp

from syspro_to_ops.operator_activity as oa;

6 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You're creating OATimestamp as a new field. That's why peek can't find it. You'll have to use the original name:

peek(timestamp) as PastTimestamp


talk is cheap, supply exceeds demand
Not applicable
Author

if i use


peek(timestamp) as PastTimestamp2,//testing

if(peek(sessionID)=sessionID,dayStart(timestamp(peek(timestamp)))-dayStart(timestamp(timestamp)))as TimestampDiffTest;//testing

i get no result either for PastTimestamp2 nor for TimestampDiffTest

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You need single quotes around your fieldname in the peek().

peek('OATimestamp')

-Rob

http://robwunderlich.com

Not applicable
Author

Tried both of the proposed solution but it do not seem to work.

I am wondering how can


peek(OATimestamp) as PastTimestamp,//testing 2

give a result and

if(peek(sessionID)=sessionID,dayStart(timestamp(peek(OATimestamp)))-dayStart(timestamp(OATimestamp)))as TimestampDiffTest;//testing 3

Give null????

Not applicable
Author

Tried that as well ....no luck...

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I would think that

dayStart(timestamp(OATimestamp))

would be a "Field not found" in the current row. OATimestamp does not yet exist.

-Rob