Jump to content

This topic is 8149 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I still have a billing database and I developed a time on call field which defined dates and times physicians were on call with a strict definition of "on call" being M-F from 1800 to 0600, Sat, Sun, and holidays (which I imported from the archives here) That went fine.

Then the definition changed. Now they want to include minutes starting from 1800. So for a case that started at 1730 and went to 1830 previously would NOT be a call case because it started before 1800. Now they want this same case to count towards 30 minutes of call. Here is my calc with an explanation below.

Case(DayOfWeek = ("Monday" or "Tuesday" or "Wednesday" or "Thursday" or "Friday") and (Start Time >= Time(6,0,0) or Start Time <= Time(18,0,0)) and (End Time <= Time(18,0,0) and End Time >= Time(6,0,0)), Total Time, (DayOfWeek = "Monday" or "Tuesday" or "Wednesday" or "Thursday" or "Friday") and (Start Time >= Time(6,0,0) and Start Time <= Time(18,0,0)) and (End Time >= Time(18,0,0) and End Time <= Time(6,0,0)) , If(End Date - Start Date = 1 , Time(24,0,0 + End Time) - Time(18,0,0) , End Time - Time(18,0,0)),0)

This should calculate and give the total time (a field in the db that calculates total time for the case regardless, and works) if the case starts after 1800 or before 0600. If I end the calc at total time with a , O. It works, giving the total time for cases in that range and O otherwise. When I add the second case statement, the first no longer works nor does the second. I want the second to calculate for a start time of 1730 and end time of 1830, to calculate 30 minutes (time after 1800) or say 1735 and 1922, 1 hour 22 minutes (again time after 1800). Saturday and Sunday are all day so they are easy to do. Any ideas.

Posted

I didn't try to dissect the rest of this, but wanted to point out:

DayOfWeek = ("Monday" or "Tuesday" or "Wednesday" or "Thursday" or "Friday")

will always return FALSE, I believe. It should probably be written:

DayOfWeek = "Monday" or DayOfWeek = "Tuesday" or ...

or you can shorten that to:

not (DayOfWeek = "Saturday" or DayOfWeek = "Sunday")

HTH.

This topic is 8149 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.