Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Bug comparing time stamp in load script

Dear all,

Attached please find the qvw and qvd to illustrate my problem while attempting to load records with the most recent time stamp.  I ended up applying a workaround.  I appreciate it if you can provide a proper solution.

/LC

Tags (1)
8 Replies
mov
Esteemed Contributor III

Re: Bug comparing time stamp in load script

Lawrence, try

WHERE TimeStamp >= '$(vMostRecent)'

I suspect that without single quotes it considers the variable as expression and tries to calculate

The workaround works because this -.0.0000001 converts timestamp format to numeric, which is OK to compare with the timestamp.

aveeeeeee7en
Valued Contributor III

Re: Bug comparing time stamp in load script

Hi Lawrence

Use Group By() function to get Max Timestamps with every Id

Try this:

LOAD

Id

Max(TimeStamp) as mostRecent

FROM

TimeStampProblem.qvd

(qvd) Group By Id;

Hope that helps you.

Regards

Aviral Nag

Re: Bug comparing time stamp in load script

Hi Lawrence,

Try below

temp:

LOAD Max(TimeStamp) as mostRecent

FROM

TimeStampProblem.qvd

(qvd);

LET vMostRecent = Peek(mostRecent);

DROP Table temp;

Items:

LOAD TimeStamp, Id

FROM

TimeStampProblem.qvd

(qvd)

WHERE TimeStamp >= '$(vMostRecent)' // this doesn't work

//WHERE TimeStamp >= $(vMostRecent) - 0.00000001 // my workaround

;

// ----- clean up -----

LET vMostRecent = Null();

Regards

ASHFAQ

Not applicable

Re: Bug comparing time stamp in load script

Michael,

The ' ' doesn't appear to be the problem; I've tried.

The problem appears to be that the value TimeStamp is exactly equal to vMostRecent. Incidentally, both are numeric. That's why I think the workaround works.

/LC

Not applicable

Re: Bug comparing time stamp in load script

Ashfaq,

The ' ' around the variable doesn't appear to be the bug. The problem I think is that incidentally TimeStamp and vMostRecent appear to have identical numeric value. That's why I think my workaround works.

/LC

Not applicable

Re: Bug comparing time stamp in load script

Hi Aviral Nag,

Thanks for replying. Locating the correct max timestamp value isn't the source of the bug. The bug is in the WHERE clause.

/LC

Re: Bug comparing time stamp in load script

Hi
I have even changed variable defination

Earlier


LET vMostRecent = Peek('mostRecent');

Now

LET vMostRecent = Peek(mostRecent);


Regards

ASHFAQ

mov
Esteemed Contributor III

Re: Bug comparing time stamp in load script

The "exactly equal" is the explanation.  It's impossible to have timestamps exactly equal.  Use your workaround, or use > instead of >=

Community Browser