kitster100
IS-IT--Management
I am trying to compare the difference in two date-time fields suing the PREVIOUS function in Crystal. My problem is that Crystal won’t let me summarize my result in any way, whether it’s a Count, Average, or anything else. I get the error: “This field cannot be summarized”.
My two date-time fields are:
-Patient_Datetime_IN_Room.
-Patient _DateTime_Out_of_Room
I am calculating the room turnover (Room T/O), that is, the minutes between when, say, PT (patient) A was wheeled out of surgery, and the NEXT PT was wheeled in to the same room to undergo surgery.
Here’s what my Detail section on my report looks like
PT # PT Room Patient_Datetime_IN_Room Patient_DateTime_Out_of_Room room T/O
1 10 8-5-13 07:15:00 8-5-13 9:00:00 none (1st case of day)
2 10 8-5-13 09:15:00 8-5-13 10:00:00 15
I am trying to average the turnover at a monthly level (across all room), which means I need a fomula to calculate:
Jan T/O Avge: 25 Min
Feb. T/O Avge: 20 min
I also need to group by room at a later time. (i.e., Avge turnover for room 10 for Jan: 15 min, etc)
So, room T/O is PT 2’s time In minus PT 1’s time out of room. (9:15 minus 9:00=15 min)
My formula to for the detail section to calculate room turnover is:
//Formula: @turnover
(if datediff ("n", previous({EpicCases.Pat_DateTime_ OutofRoom}),{EpicCases.Pat_DateTime_InRoom})>=60
or datediff ("n", previous({EpicCases.Pat_DateTime_ OutofRoom}),{EpicCases.Pat_DateTime_InRoom})<0
then tonumber({@fnull})
else
if(time({EpicCases.Pat_DateTime_InRoom})in time(6,30,00) to time(17,00,00))
then
datediff ("n", previous({EpicCases.Pat_DateTime_ OutofRoom}),{EpicCases.Pat_DateTime_InRoom}))
//end formula
First, I am filtering out any turnover time between cases greater than 1 hour. Also, using an empty formula (@fnull), I’m excluding data entry errors where the wrong time was entered which leads to a minus turnover. (Rare, but it happens).
Next, I use the PREVIOUS function to calculate the minutes elapsed between time in to room for the most recent patient vs. time out of the room for the patient immediately before him/her, for the same room.
As I mentioned, when I try to do any summary calculation, I get the error: “This field cannot be summarized”.
At first I thought that perhaps my @turnover formula was not a number datatype. However, it is a number. I even tried creating a new formula called @makeTurnoveraNumber, and used the tonumber convert function on my @turnover formula, like this:
//formula: @ makeTurnoveraNumber
Tonumber({@turnover})
It did not work. Evidently, using the PREVIOUS function eliminates any possibility of summarizing anything in which it’s used, is that right?
I’m running Crystal Reports 10.0.0.53 (Crystal 10).
If so, what can I do to summarize the @turnover at both the group, and report level?
Any help would be appreciated. Thank you in advance.
My two date-time fields are:
-Patient_Datetime_IN_Room.
-Patient _DateTime_Out_of_Room
I am calculating the room turnover (Room T/O), that is, the minutes between when, say, PT (patient) A was wheeled out of surgery, and the NEXT PT was wheeled in to the same room to undergo surgery.
Here’s what my Detail section on my report looks like
PT # PT Room Patient_Datetime_IN_Room Patient_DateTime_Out_of_Room room T/O
1 10 8-5-13 07:15:00 8-5-13 9:00:00 none (1st case of day)
2 10 8-5-13 09:15:00 8-5-13 10:00:00 15
I am trying to average the turnover at a monthly level (across all room), which means I need a fomula to calculate:
Jan T/O Avge: 25 Min
Feb. T/O Avge: 20 min
I also need to group by room at a later time. (i.e., Avge turnover for room 10 for Jan: 15 min, etc)
So, room T/O is PT 2’s time In minus PT 1’s time out of room. (9:15 minus 9:00=15 min)
My formula to for the detail section to calculate room turnover is:
//Formula: @turnover
(if datediff ("n", previous({EpicCases.Pat_DateTime_ OutofRoom}),{EpicCases.Pat_DateTime_InRoom})>=60
or datediff ("n", previous({EpicCases.Pat_DateTime_ OutofRoom}),{EpicCases.Pat_DateTime_InRoom})<0
then tonumber({@fnull})
else
if(time({EpicCases.Pat_DateTime_InRoom})in time(6,30,00) to time(17,00,00))
then
datediff ("n", previous({EpicCases.Pat_DateTime_ OutofRoom}),{EpicCases.Pat_DateTime_InRoom}))
//end formula
First, I am filtering out any turnover time between cases greater than 1 hour. Also, using an empty formula (@fnull), I’m excluding data entry errors where the wrong time was entered which leads to a minus turnover. (Rare, but it happens).
Next, I use the PREVIOUS function to calculate the minutes elapsed between time in to room for the most recent patient vs. time out of the room for the patient immediately before him/her, for the same room.
As I mentioned, when I try to do any summary calculation, I get the error: “This field cannot be summarized”.
At first I thought that perhaps my @turnover formula was not a number datatype. However, it is a number. I even tried creating a new formula called @makeTurnoveraNumber, and used the tonumber convert function on my @turnover formula, like this:
//formula: @ makeTurnoveraNumber
Tonumber({@turnover})
It did not work. Evidently, using the PREVIOUS function eliminates any possibility of summarizing anything in which it’s used, is that right?
I’m running Crystal Reports 10.0.0.53 (Crystal 10).
If so, what can I do to summarize the @turnover at both the group, and report level?
Any help would be appreciated. Thank you in advance.