Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread Subtracting dates
Wed, Mar 9 2016 9:33 AMPermanent Link

Suzanne C Nuss

I am doing a simple date difference:  DischargeDate-AdmissionDate = Length of Stay
Delphi XE7, ElevateDB 2.18b3

If i run this in EDBMgr, all is well - i get the difference in days.
whether I use:  

Select from ClientProgram
ClientProgram.DischargeDate -ClientProgram.AdmissionDate as  LOS
or
Select from ClientProgram
(ClientProgram.DischargeDate -ClientProgram.AdmissionDate as INTERVAL DAY) as LOS

When i put the query into DelphiXE7 Query object and put the query into place (either syntax)
I consistently get a result in milliseconds.

Yes, i can adjust this on my report by dividing by 86400000 but it is driving me crazy.  I trolled through the support groups on Interval arithmetic but didn't see anything that suggests my error.

Any ideas?  tia
Suzanne
Wed, Mar 9 2016 10:24 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Suzanne

Try

Select from ClientProgram
(ClientProgram.DischargeDate -ClientProgram.AdmissionDate) DAY as LOS

Roy


Wed, Mar 9 2016 1:11 PMPermanent Link

Suzanne C Nuss

Roy,


Thanks -

I tried that first - before i tried the variation INTERVAL DAY no luck.   It is quite bizarre -

For most things, i get around it by testing for order eg. DischargeDate > Current_Date (eg. when agencies put in DischargeDate at the same time they admit a client).  In this case, I need to measure & average the LOS so i can't use that work around.  My particular problem is that i can do the division and get the correct column entries but the next step - averaging the LOS on DigitalMetaphors ReportBuilder then fails.

As i said, I test all the queries first in EDBMgr; this issue with DelphiXE7 is weird.

Roy Lambert wrote:

Suzanne

Try

Select from ClientProgram
(ClientProgram.DischargeDate -ClientProgram.AdmissionDate) DAY as LOS

Roy
Thu, Mar 10 2016 3:55 AMPermanent Link

Matthew Jones

Suzanne C Nuss wrote:

> Yes, i can adjust this on my report by dividing by 86400000 but it is
> driving me crazy.

Wasn't there a report recently of some date calculation going "mad"
like this? Worth checking back, as it was due to be fixed.

--

Matthew Jones
Thu, Mar 10 2016 7:51 AMPermanent Link

Suzanne C Nuss

I thought so too - i checked the incident reports and newsgroups but couldn't find it - which is why i posted, hoping somebody else had experience with it.

Thanks
Thu, Mar 10 2016 8:21 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Suzanne


Like Matthew I'm pretty sure its in here somewhere, I just can't come up with the right terms to find it.

Roy Lambert
Fri, Mar 11 2016 7:52 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< Wasn't there a report recently of some date calculation going "mad" like this? Worth checking back, as it was due to be fixed. >>

There were these incidents recently:

http://www.elevatesoft.com/incident?action=viewaddr&category=edb&release=2.22&incident=4360
http://www.elevatesoft.com/incident?action=viewrep&category=edb&release=2.20&incident=4260
http://www.elevatesoft.com/incident?action=viewrep&category=edb&release=2.20&incident=4259

But that's it, and they were mostly edge cases.

Tim Young
Elevate Software
www.elevatesoft.com
Image