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

Find records between 15:15 Friday to 07:00 Monday

Status
Not open for further replies.

orstats

Technical User
Jan 15, 2009
2
CA
I have been all over and haven't been able to find a solution to this. I am using Crystal Reports 2008 reporting from a SQL database. I work in a pediatric OR and I need to report on all cases done over the weekend.

In this case a weekend is defined as from Friday, 15:15 hrs to Monday, 07:00 hrs. Any procedure performed within that time period is automatically classified as an emergency procedure.

Now I have no problem with the days. I could easily report on Saturday and Sunday or whatever 24 hour period but it's starting the search at 15:15 on Friday and cutting it off at 07:00 on Monday that I can't get.

The field with the date is actually a DateTime field which would make it easy except that the times aren't actually entered so they're all 00:00:00. And the field with the procedure times is actually a number field.

Any help would be greatly appreciated! Thanks
 
It would help for you to provide a sample showing how your data is actually stored, complete with sample values, and then also show a mock up sample of what you would like to see.
In addition, any formulas you are already using that would interact with the solution need to be provided.

you could use something like below to identify the cases needed - they would have a 1 and the cases that did not meet criteria would have a 0.


//{@fri1715tomon0700}
IF isnull({table.Datetime}) or TRIM(totext({table.Datetime}))="" then 0
else
(
IF Day({table.Datetime}) = 6 and {table.timenumber} > 1715 then 1 else
(
IF Day({table.Datetime}) = 7 then 1 else
(
IF Day({table.Datetime}) = 1 then 1 else
(
IF day({table.Datetime}) = 2 and {table.timenumber} < 700 then 1 else
0
)))

 
Thanks for the answer. I'll be away from my desk until Tuesday so won't have any access to post the requested samples but I'll try to get something up then.

I'll also try your formula and any others given and post what happens.

Thanks fisheromacse
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top