Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Differences in Interval() between 64- and 32-bit version?

So, I've been going a little crazy trying to figure this out, but I think I've finally narrowed it down. 

I want to figure out the age of a record by getting the difference between today and the date the record was created.  I used the following code as an expression in a crosstab table:

= Interval(Date(now(2), 'MM/dd/yyyy hh:mm') - Date#([UCO Open Date], 'MM/dd/yyyy hh:mm'),'dd')

On my 32-bit machine, which I use for development, this worked fine.  So, I deployed it and later on noticed that all the Ages were "0".  Eventually, I narrowed it down by brute force to the following code, which works on the 64-bit machine:

= Interval(Date(now(2), 'MM/dd/yyyy hh:mm') - Date([UCO Open Date], 'MM/dd/yyyy hh:mm'),'dd')

Notice: all I did was change Date#() to Date(). 

Now, I'd be happy with this, but the latter snippet does not work on a 32-bit machine.  All the Ages become 0 when I try this on the 32-bit system.  So, I'm a little baffled.  Perhaps I'm doing something wrong, maybe I should move this into the script?  If I had some way to test for the OS, I could switch between the two, and while that seems a little silly, it won't be the first time I have done such a thing.

Both versions on the machines are identical (other than the different -bit).  This effect appears on the QV Accesspoint, as well, which is also 64-bit. 

Any suggestions as to whether I'm dealing with a bug, or doing something wrong?

(I've attached the file in case anyone wants to have a look.  This would be the Age column on the Unassigned Change Orders table on the Book of Work w/Change Orders tab)

4 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Perhaps you are overcomplicating the expression. Now() returns a date/time value. If [UCO Open Date] is also a date/time value, then

=Interval(Now(2) - [UCO Open Date], 'dd')

should work on both 32 and 64 bit machines.

No, I don;t know why the other expressions were uneven on 32 and 64 bit, but I don't think they are necessary.

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
hic
Former Employee
Former Employee

When I look in your application, I can see that the [UCO Open Date] has not been interpreted as date. So you need to use an interpretation function: Date#([UCO Open Date], 'M/D/YYYY hh:mm').

Further, I suspect that the Now(2) is not well defined on a server: The "2" means "when the document is opened" and that is not necessarily the same as when the session is opened. But I have not verified this.

So I would suggest that you use the following expression:

= Interval(now(0) - Date#([UCO Open Date], 'M/D/YYYY hh:mm'),'dd')

HIC

Not applicable
Author

Jonathan Dienst wrote:

Hi

Perhaps you are overcomplicating the expression. Now() returns a date/time value. If [UCO Open Date] is also a date/time value, then

=Interval(Now(2) - [UCO Open Date], 'dd')

should work on both 32 and 64 bit machines.

No, I don;t know why the other expressions were uneven on 32 and 64 bit, but I don't think they are necessary.

Hope that helps

Jonathan

Thanx for the response, Jonathan.  This works on my 64-bit machine, but not on the 32.  This is pretty much what I started with and the fact that I couldn't get this to work is what prompted me to bring in the Date functions to begin with.

Not applicable
Author

Henric Cronström wrote:

When I look in your application, I can see that the [UCO Open Date] has not been interpreted as date. So you need to use an interpretation function: Date#([UCO Open Date], 'M/D/YYYY hh:mm').

Further, I suspect that the Now(2) is not well defined on a server: The "2" means "when the document is opened" and that is not necessarily the same as when the session is opened. But I have not verified this.

So I would suggest that you use the following expression:

= Interval(now(0) - Date#([UCO Open Date], 'M/D/YYYY hh:mm'),'dd')

HIC

Thanx for the response, Henric,

This works on my 32-bit system but not on the 64. 

I'm thinking that maybe I should just go back to my datasource and calculate the date there.  I'm really quite baffled. 

Thanx again for trying, guys.