Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate difference between end date time and start date time

Status
Not open for further replies.

reportwriter2

Technical User
Jul 21, 2009
1
US
I need to calculate the difference between the time a surgery stops for one patient and the time the next surgery starts for the next patient -- grouped by surgeon. So I am working with the stop date time of one record and the start date time of the next record.

Looks like:

Dr. A.
Patient A Case start: 8:00 Case stop: 9:00
Patient B Case start: 9:15 Case stop: 10:00
Turnover time: 15 minutes
Dr. B
Patient C Case start: 8:30 Case stop: 9:45
Patient B Case start: 9:57 Case stop: 11:00
Turnover time: 12 minutes

I used DateDiff but it compared the start and stop times of the same patient. I could not get it to give the difference between Patient A and Patient B.

Thanks for any help or advice you can give me.
Thanks for any input.
 
You can use DateTime Variables. Then use datediff on those.

However, you need some logic or group that relates patient a to B, what happens if there are patients c, d etc.

What version of Crystal and DB are you using.

Ian
 
Try something like this:

if {table.surgeon} = previous({table.surgeon}) then
datediff("d",previous({table.stoptime}},{table.starttime})

Ian is correct that you would have to use variables if there were more than two patients and you needed to add the differences per surgeon.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top