Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I don't know if this is a bug or a wrong description in the help file:
now( [ timer_mode] )
Returns a timestamp of the current time from the system clock. The timer_mode may have the following values:
0 Time at script run
1 Time at function call
2 Time when the document was opened
The real Now(0) Behavior:
Now(0) will return the time of the last preceding script run, as you can see in the attached example. But according to the help description I would excpect the starting time of the current script run..
- Ralf
Yes, I would agree that the documentation is kind of weak here.
Since the script execution or 'last preceding script run' is not a point in time, but a period, I think it should state even more precisely (for timer mode 0):
Returns a timestamp for when the script last finished reexecuting.
Or something similar (copied the statement from ReloadTime() documentation. So it's all there, somewhere in the docs...
Right, but I guess the initial intention of this function called "now" was to give the starting time of script run which would be very useful indeed.
Why one should provide two different functions with the same result?
now(0) = ReloadTime() // during script run
It's been this way since V8, when it was "fixed". See
http://qlikviewnotes.blogspot.com/2010/07/now-trap.html
Rob
Hi Rob,
I know this is an old hat! The question is why it was "fixed" and why the documentation is still the same wrong four versions later..
I'm sure a lot of consultants / clients using this in a wrong way..
- Ralf
The observed behavior of Now(0) is correct, however the manual is unfortuante not completely clear on the actual behavior. This has now been reported as a docuementation bug (#46375) and will be corrected for future releases.
If you want to se the actual reload time in your application, please consider caling the Now(0) directly or use a SET variable instead of LET to accomplish the expected timestamp in your application.
If you on the other hand are looking for the actual reload time during reload in the script, please use Now(1) as it will give the current time.
Thank you Rob for your answers and your blog. Without which, I would still be searching for answers like this one.