Skip to Content
avatar image
Former Member

Return result within timeframes of several days

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 08, 2008 at 07:30 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 08, 2008 at 07:33 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 08, 2008 at 07:39 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded