cancel
Showing results for 
Search instead for 
Did you mean: 

Return result within timeframes of several days

Former Member
0 Kudos

Hi All,

I am using CR2008 and designer to create a report. I am having a question regarding timeframe.

I want to return a result within a timeframe in the past several days.

I have a date range and time range parameters for user to specify a date range and time frame within the days. For instance return the results in the past 10 days between 6:30 AP to 4:30PM

I know the below works for a pair of start/end date.

{table.field} in {?Date Range}

I am wondering if anyone know how to create formula in Select Expert to handle the time frame in a date range?

Thanks in advance.

Dennis

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

If you have a date/time field create two new time parameters start time and end time:

Then change your record selection to:

({table.field} in {?Date Range})

AND

(Time ({table.field}) >= {?StartTime} and Time ({table.field}) <= {?EndTime})

Edited by: James Terry on Sep 8, 2008 10:13 PM

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Dennis

Is it possible for you to define the field as DateTime datatype in the database itself.

It could make a lot of date time manipulations in the Crystal Reports easier.

The current requirement would get taken care of automatically if this is possible.

Former Member
0 Kudos

Thanks folks. That works.

Former Member
0 Kudos

Dennis,

Try this:

{table.field} in (DateAdd('d', {?NumOfDaysParameter}, CurrentDate) to CurrentDate) AND

Time({Table.Field}) in (Time(6:30 AP) to Time(4:30PM))

Jason