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

Using date time field to show select results 1

Status
Not open for further replies.

sorchard2000

Technical User
Aug 3, 2004
57
US
Running Crystal 8.5 on SQL Server.

I'm sure this is easy for you all but it's driving me nuts. I need to create a report where the selection parameters allow the user to put in the start and end datetime however, I only want the results to show cases that were scheduled between 7:30am and 8:00am (based on the casemain.schedcase_start_datetime field.) The only grouping that I currently have is based on a surgeon last name. Results showing in detail band. Record selection formula below:

{casemain.resunit_id} = 4 and
{casemain.schedcase_start_datetime} in {?StartDate} to {?StopDate} and
{delayreason.name} = "DOCTOR DELAYED"

Any ideas?
Any help would be greatly appreciated!!!

sorchard2000
 
So you want to allow for any dates, but only allow times bewteen 7:30am to 8:00am?

I'd change the parameter to a date, not datetime, and alter the Record Selection to:

(
{casemain.resunit_id} = 4
)
and
(
{casemain.schedcase_start_datetime} >= cdatetime(year({?StartDate}), month({?StartDate}), day({?StartDate}),7,30,0)
and
{casemain.schedcase_start_datetime} <= cdatetime(year({?StopDate} ), month({?StopDate} ), day({?StopDate}),8,0,0)
)
and
(
{delayreason.name} = "DOCTOR DELAYED"
)

-k
 
Thank you SO much for your suggestion--it worked like a charm!

I appreciate it!

sorchard2000
 
OK-slight problem has emerged:
synapsevampire's suggestion initially worked but now it doesn't. As suggested, I changed the parameters to Date instead of DateTime and it still doesn't work. It displays all times instead of just 7:30-8:00am times. That was the only change I made.

Any suggestions?
 
Try:

{casemain.resunit_id} = 4 and
{casemain.schedcase_start_datetime} in {?StartDate} to {?StopDate} and
{delayreason.name} = "DOCTOR DELAYED" and
time({casemain.schedcase_start_datetime}) in time(7,30,0) to time(8,0,0)

-LB

 
OK--I did better testing this time and lbass' suggestion definately worked! Thanks! My boss will be happy.

sorchard2000
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top