Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm using QV10 SR2 and I'm a little bit confused about function Today(). In help it states that there are 3 different modes:
0 Date at script run
1 Date at function call
2 Date when the document was opened
Default timer_mode is 2. The timer_mode = 1 should be used with caution, since it polls the operating system every second and hence could slow down the system.
But when I execute it in mode 2 (default) or 0, it gives me old dates. I would expect that...
So, what's wrong then?
Then must Today() give also the right value!
I'm with you, but don't forget I tested it by now and not on daily reload. It looks like the first reload on a new day returns the old date of the day before, every subsequently reload seems to work.
ok, so that makes me crazy, too!
It looks like it uses Today(0).
May I ask where you use the today() call? In the script or UI?
And you use the Server to schedule the reload?
If you use it in the script and you want to make sure to always get the current date, I would suggest to use Today(1).
I think the script run date ( Today(0) ) will not be set before after the run has finished.
Yeah, you are right. It's in the script and the reload is scheduled on server.
Right, my current workaround is to use Today(1). But from my point of view it should also work if I use Today() or Today(2). And help says something about performance issues when I use Today(1).
swuehl schrieb:
I think the script run date ( Today(0) ) will not be set before after the run has finished.
Yes, Martina already mentioned that.
I believe you won't get any performance issues in the script. This note is considering UI use only, IMHO.
What I intended to say:
Today(0) will return the date of the last successful script run. So, on the first run of a day, you get the previous day returned (edit: if called from the script, like in this case!)
Not sure about today() / today(2), this might be depending on how the server handles your document while reloading / if your document is already open.
Yeah, that's it. Help considers only use in UI, not in script.
That means if reload is done by server then the document isn't really open. If I use Today()/Today(2) in script then I get the date when I last opened the document in QV client. That means the only way to get around this is to use Today(1) instead (only true if used just in script)!!
Cheers everybody!
See http://qlikviewnotes.blogspot.com/2010/07/now-trap.html for more on this issue. The blog discusses now(), but applies to today() as well.
-Rob
Today(0) is the date of the previous reload not the date at script run !!!