Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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;
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
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
You need single quotes around your fieldname in the peek().
peek('OATimestamp')
-Rob
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????
Tried that as well ....no luck...
I would think that
dayStart(timestamp(OATimestamp))
would be a "Field not found" in the current row. OATimestamp does not yet exist.
-Rob