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

Assign a label to designate order of a case 1

Status
Not open for further replies.

Jonathan212

IS-IT--Management
Oct 22, 2002
57
US
Does anyone have a suggestion as to how I might add a comment that I could insert into a report that would show what number case of the day it was for a particular surgeon. On any given day our surgeons may operate in several different locations in the hospital such as ambulatory surgery center, inpatient center, special procedures unit, etc.

For example, say “surgeon” Dr. Kildare did seven cases with “procedure start” times of 8:03, 10:15, 14:23, 12:05, 9:07, 17:45 and 16:20 I would like to be able to generate the following output:

Kildare, 8:03 this was the surgeon’s 1st case of the day
Kildare, 10:15 this was the surgeon’s 3rd case of the day
Kildare, 14:23 this was the surgeon’s 5th case of the day
Kildare, 12:05 this was the surgeon’s 4th case of the day
Kildare, 9:07 this was the surgeons 2nd case of the day
Kildare, 17:45 this was the surgeon’s 7th case of the day
Kildare 16:20 this was the surgeon’s 6th case of the day

There is also a case number (sequentially assigned to a case when it is scheduled), that is unique for each case. So, I could possibly add something like for Dr. Kildare, Case Number 123456 was his 1st case of the day.

I realize one alternative, of course, is to simply group cases by surgeon and sort in procedure start time order.

I am using CR10.
 
You're asking it to find the order of a record in a sequence that you're not using? That's a bit tricky for Crystal, which is a reporting tool rather than a full language.

What you could do is pass details to a subreport, which would check and save the value of a running total for the specified time, for records in the correct order. Pass this back as a Shared Variable, or just display the subreport next to the detail.

Subreports at detail line level eat up a lot of machine time, since each instance of the subreport does a separate request for data. But it may be the only way.

If you were content to have the order separate from the main data, this could be done by a single subreport in the header or footer.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Many thanks for your suggestions and help this week. You have helped me on the road to a solution. Much appreciated. Jonathan
 
You might be able to use a formula like this:

stringvar x := "";
if {table.time} = nthsmallest(1,{table.time},{table.surgeon}) then
x := "1st" else
if {table.time} = nthsmallest(2,{table.time},{table.surgeon}) then
x := "2nd" else //add additional cases
;
if x <> "" then
"This is the surgeon's "+ x + " case of the day."

-LB
 
LB, many many thanks for your solution. Yet again, I am happy to report, it works perfectly. I am most appreciative to you. Jonathan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top