Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
mov
Champion III
Champion III

Function now() in 8.50

I'm using now() on the QV-Server based application. Users who access the server are in the different time zones.
In QVS 8.01, the function returns the timestamp of the current time from the system clock on the user machine - this is exactly what I need.
In QVS 8.50, it returns the timestamp of the current time from the system clock on the server, and this is a big problem. I tried now(2) - same result.
Need help getting system time of the user machine for the server-based application. Appreciate any advice.

PS: The function is used in macro, so it doesn't make CPU to work hard. Same as using now(2) - time when the document was opened.

1 Solution

Accepted Solutions
mov
Champion III
Champion III
Author

Here is the solution,
Instead of using QlikView function "now", I'm using the VBscript function "now". For convinience, I'm assigning it to a variable. Technically it returns the same result as now(2) because the macro is part of OnOpen, but works in any situation, locally or on from server. The macro:


sub vNow
n = CDbl(now)
ActiveDocument.Variables("vNow").SetContent n, true
end sub


Thanks all for help!Yes

View solution in original post

6 Replies
Not applicable

Michael,

I am using version 8.50.6261.5 and my Now() function is the time on my system. I changed my system clock and it correctly changed on a text box.

I was able to recreate this using a macro and a text box.

EDIT: I'm guessing the difference may be that your applications are being run from the server, while I am opening mine directly?

mov
Champion III
Champion III
Author

Exactly. No problem locally, just in server. And, no problem if server is 8.01. It doesn't work as expected in server 8.50. Sad
Client version was 8.50 in both cases, but I suspect it doesn't matter.

johnw
MVP
MVP

We reported a different but related problem with now() when moving from 8.? to 8.5. One of the old versions of now() gave you the START time of the reload. In version 8.5, that version of now() no longer existed. We had to instead store off now() at the start of the script in a variable, then use the variable to know when the load started. Our complaint was met with "working as designed", even though it wasn't backwards compatible, and they'd dropped a working feature.

I suspect you'll get the same answer, but it's worth at least bringing up. I really don't think they should have dropped EITHER of these useful features, or changed which parameters yielded which results. If they wanted NEW versions of now(), these should have been added as new options rather than having the new versions replace the old versions. Probably water under the bridge at this point, and I have no idea how else you can solve your problem.

Grumble grumble.

Not applicable

Yeah, you would think, the more options, the better. Why not have multiple functions for the various versions of Now()?

As for the local time problem, I wonder if you could get it from an external Excel object using a macro. You could programatically open Excel, set a field to Now() and then read that field into a variable. I would assume that the Excel instance would be opened locally and therefore Now() would be the user's time.

I don't have any apps running from the server, so I can't test it out. I also don't know if this would be more work than it's worth.

mov
Champion III
Champion III
Author

Thanks NMiller,
I don't want to use Excel, but you gave me a direction...

mov
Champion III
Champion III
Author

Here is the solution,
Instead of using QlikView function "now", I'm using the VBscript function "now". For convinience, I'm assigning it to a variable. Technically it returns the same result as now(2) because the macro is part of OnOpen, but works in any situation, locally or on from server. The macro:


sub vNow
n = CDbl(now)
ActiveDocument.Variables("vNow").SetContent n, true
end sub


Thanks all for help!Yes

View solution in original post