I have Crystal XI and I write reports for a surgery department with 11 operating rooms. I need a formula that will select just the first case record of the day for each room no matter what time it started.
I am not sure I am following you. Some times the first surgery in a room could be at 10:00 and some at 7:30. I am trying to find just the first case of the day for each room so I can report on the on time starts.
I went back to a similar report I had built (calculate average time for first case of the day over a given period).
I needed to have more fields than just the time displayed so. So if this is the case for you, here is a simplification:
GH1 - DATE
GH2 - Theatre
<Formula INIT>
//insert this formula in the GH2
//Set to highest possible time in the day
//Create shared variables for each field you would like to display (I put PatientName and MRN as an example)
<Formula FIRSTCASE>
//insert this formula in the details section
//include all the variables that you put in the Init formula
Shared Timevar tInit;
shared Timevar tFirstCase;
Shared Stringvar strPatientName;
Shared Stringvar strMRN;
//include all the variables that you put in the Init formula
If {ORtime.field} < than tInit then
(
tFirstCase := {ORtime.field};
strPatientName := {PatientName.field}
strMRN := {MRN.field}
(repeat for whatever fields you included)
);
Now depending on how you want to display this information you would create formulas that call the shared variable in
GH2.
hopefully this is clear, I haven't had my morning cofee yet ; )
If you have a group on room and then date or date and then room, you should be able to insert a minimum on the datetime field at the appropriate group level.
I tried the formula and it is getting hung up on the than in the IF statement
Here is a copy of what I have so far.
//<Formula FIRSTCASE>
//insert this formula in the details section
//include all the variables that you put in the Init formula
Shared Timevar tInit;
shared Timevar tFirstCase;
Shared StringVar strcrn;
//include all the variables that you put in the Init formula
If {v_basic_booking_data_ODBC.book_setup_start_time} <= than tInit then
(
tFirstCase := {v_basic_booking_data_ODBC.book_setup_start_time};
strcrn := {v_basic_case_rec_data_ODBC_new.cr_urn};
// (repeat for whatever fields you included)
//);
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.