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

DateTime help

Status
Not open for further replies.

jobillborf

Programmer
Feb 13, 2001
61
US
Greetings
I have a field called compdate (datetime field). Question, I would like to know all records completed on the 4pm - 12pm shift and completed on the 12am - 8am shift.

This report will be done monthly, in other words it has a paramater (datetime) for the beginning date and ending date. Thank you

 
I'm assuming that your times remain static whilst your dates are parameter driven.

Using a date parameter, I imagine your record selection criteria would look like:

(
{CompDate} in DateTime({?DateParameter},16,0,0) to DateTime({?DateParameter},23,59,59)
or
{CompDate} in DateTime({?DateParameter},0,0,0) to DateTime({?DateParameter},8,0,0)
)

If your parameter was datetime, like your post suggests, then you'd just most likely use a two ranged parameters with a record selection like:

(
{CompDate} in {?DateParameter}
or
{CompDate} in {?DateParameter2}
)

Use if, case, or specified grouping to split up the ranges in the report.

Naith
 
I'm trying to do the same thing. I have a date parameter and I need to pull info from 7am to 3pm for a particular shift.
Crystal v8.0 / SQL DB

Here's my select statement:
{vw_oc_sel_allprsnphone.OnCallFromDate} in
datetime({?Date},7,00,00) to datetime ({?Date},3,0,0)
and
{vw_oc_sel_allprsnphone.OnCallToDate} in
datetime({?Date},7,00,00) to datetime ({?Date},3,0,0)

I receive an error that when trying to save the select criteria indicating "A time is required here".
({?Date),7,00,00) - I thought the 7,00,00 was indicating my time. I tried changing the parameter to a datetime parameter but still didn't work.

Ideally my report would list all employees On Call for a specific date and for a specific Time Frame. I want the user to enter a date parameter only without having to select to & from date/time.
Suggestions?
 
I think that it's more complex than the solutions offered cover.

I made a stab at providing this solution in:

javascript:eek:penindex(450,350,'
The essence being that the above solutions only address a single day, which is simple, you want to pull data for all days, but only for specific time periods.

This means one set of criteria to filter the dates, and a separate set to filter only certain hours (that was my proposed solution, add in additional criteria to filter based on the hour() function).

I'd do this within a View or SP, though Crystal can handle it.

-k kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top