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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formulas to caluculate the difference between date/times

Status
Not open for further replies.

VBugDenver

Technical User
Feb 18, 2011
16
US
I have a question about caluculating dates/times:

I have a report that that uses the following fields; {Schedule.ApptDtTm} and {Schedule. Activity} that gives me a time-line of scheduled appointments based on the activity. The results of my report looks like this:

Patient: XXX
DATE/TIME ACTIVITY
1/18/2011 10:30 am Simulation
1/19/2011 5:15 pm Volumes Approved
1/22/2011 11:00 am Plan Approved
1/24/2011 9:20 am Chart Check
1/25/2011 3:45 pm Treatment

I need to calculate the date and time between the following activities:

Simulation to Volumes Approved
Volumes Approved to Treatment
Plan Approved to Treatment
Chart Check to Treatment

Any ideas?
 
Insert a group on patient. Then create formulas like this:

//{@simulation}:
if {Schedule. Activity} = "Simulation" then
{Schedule.ApptDtTm}

//{@Volumes Approved}:
if {Schedule. Activity} = "Volumes Approved" then
{Schedule.ApptDtTm}

Repeat for each activity. Then use formulas like the following to show the differences in the patient group section:

datediff("s",maximum({@simulation},{table.patientID}), maximum({@Volumes Approved},{table.patientID}))

"s" is for seconds. You could use minutes ("n"), hours ("h"), etc. Then if you wish to convert the result to some kind of string, you can.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top