Link to home
Start Free TrialLog in
Avatar of AnandSahoo
AnandSahoo

asked on

Tima parameter in Crystal report 2008

Hi Team,

Hope someone can help me in this query.
I have a table which has a column called Open_time.This contains the datetime value.
I am running adhoc 10days report by creating startdate and enddate as parameter.
record selection looks like open_time >= {?StartDate} and open_time <= {?enddate}
where startdate lets say 03/01/2011 00:00:00 and enddate is 03/10/2011 23:59:59
Now I need to select those records where open_time in between those date range is 22:00 (10 PM) to morning 8 AM(out of businees nours)
Your early response will help me a lot.
Avatar of nsonbaty
nsonbaty
Flag of Egypt image

the date end and start are parameters, but inside the report you use a formula

if Hour (Time(open_time)>=22 and Hour (Time(Open_time))<8

then add the required action, then do your calculation on the resulted formula field
Avatar of AnandSahoo
AnandSahoo

ASKER

I need to view only those records for which open time is between 10 and 8 on so an so date range.
I have tried to put the above in the record selection formula but it doesnt return any record.
But If I check manually in the database there are records in those time.

Require your help again
in this case add then 1 as follow
if Hour (Time(open_time)>=22 and Hour (Time(Open_time))<8 then 1
and in the select expert, add condition that formula value = 1
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I did exactly the same but its not returning any numbers.
My select expert record selection looks like below
{OPEN_TIME} >= {?START DATE} AND
{OPEN_TIME} <= {?END DATE}
and {@Time} = 1

Time formula

if Hour (Time ({OPEN_TIME})) >= 22 and  Hour (Time ({OPEN_TIME})) <= 8
then 1 else 0
Hi mlmcc,

Will this work as per th erequirement ? We are using or
This will select records if any one of them is true
That should select the records you want.  It first ensures the date is in the range then checks if the hour is between 10pm and 8am

mlmcc
the rang of selectig the report is diffent than the record selections, and what I send is already done on one of my report,
again, the report rang is teh data selection for all records in the report.
then filtering the record done through the formula, that upon this formula we filter the showed records.
in the paqrameters yoiu select the rang of days or months you need to report for.
then in teh formula
if Hour (Time(open_time)>=22 and Hour (Time(Open_time)) < 8 then 1 else 0

where open_time is your field in the table ( will be diffrent when you select it from the table it self, will depend on the table name)
add the formula record to the report detail section and run the report to conform that the formula runs correctly
then depends on the crystal version, in the 2008
select reprot > select expert > records
selct new
then select the formula you just create and selct value is equal 1
this is not impossible mathematically, sepcially you should nt select 8 when add <= because 8 is in the rang of working hours
sorry, replace and by or, maybe that what they mean. but I did not get it from the first time
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial