Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Tough Formula Help Needed Post Reply Post New Topic
Author Message
JeffS23
Newbie
Newbie
Avatar

Joined: 02 Nov 2007
Location: United States
Online Status: Offline
Posts: 8
Quote JeffS23 Replybullet Topic: Tough Formula Help Needed
    Posted: 13 Nov 2007 at 9:39am
My current Formula @Hours

IF {Data.ApptKind} = 1 AND {Data.Column} = '1' THEN
{Data.ApptTime} / 60;
 
My issue has to do with the {Data.Column} = '1'.
 
This formula deals with a Doctors schedule. In the schedule, most of the time, an appointment is booked and is by default placed into Column 1. If the provider elects to double book their time, the second appointment hits the column 2. It is possible to have up to 4 appointments in one slot. This is why we wait forever at the Doctors office - appointments get overbooked because patients cancel or no show frequently and the provider would rather have the patient wait then risk no appointment at all.
 
My issue is this ....
 
If I have 2 patients scheduled from 8:30 am - 9:00 am and I cancel the patient in column 1, the system forces the patient out of Column 1. This is so another patient can be scheduled into this slot if needed. What I was intending to do with my formula was only count the time in this time slot one time not twice. I am looking to get a summary of time the provider was scheduled to see patients. So if the Provider was scheduled to see patients from 8 am to noon and had patients doublebooked for every time slot, I only want to overall time he saw patients regardless of the doublebooking, triplebooking or quadruplebooking. So the total time for my example should be 4 hours not 8 hours.
 
The issue has to do with the canceled appointments. If you recall, when that appointment is canceled, the appointment is removed from column 1. If the office cannot replace it with another patient, it is empty. This is messing my formula up. The provider still saw a patient, but that visit was sitting in column 2. What I would like to see is have it evaluate column 1 and if NULL, check the subsequent columns and if it finds a patient count that one ... if all are NULL then dont count. I hope ive explained my issue ok. If not, please dont hesitate to get more clarity. Thanks in advance!
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 14 Nov 2007 at 11:47am
Personally, I think you ought to redesign the source application, so that it bumps the person from column 2 into column 1 when the column 1 appointment is canceled.  But, that's probably not a practical solution.

Also, this problem is easier to solve with SQL.  If you can alter the view/stored proc of your report, there are easier solutions.

The basic solution requires one of two approaches.  First, go through each minute, and check to see if an appointment exists for that minute.  The downside to this is that it requires a separate list of minutes (generally handled in SQL with table that simply holds sequential numbers).  The second is to look at each appointment not in column 1, and check to see if there is an appointment in an "earlier" column, and subtract out the time difference.  This is very process intensive, especially with a large number of appointments.  (It's also only possible if you have a known upper limit on the number of columns.)

Neither of these approaches, unfortunately, are simple with formulas.  You may be able to rig something up with running totals, or a clever cross-tab. 
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.