Defining a Default Date Range

Previous Topic: Passing Parameters to Subreports by Name

Users with Crystal Reports version 9 or the Integrated Crystal Reports License can now edit the default Start and End dates for any of ServiceCEO's Crystal Reports. You can define the date range for a Crystal Report in two different ways:

  1. Use a Default Date Range

  2. Encode a Default Start/End/Single Date using Offset Notation

Use a Default Date Range

To use a default date range, you need to create a parameter named CEODefDateRange, with a data type of Number. You can set the default value of this parameter in the Public Enum eDateFiltRange table:

To set the default values, you'll need to use the following terms:

Code String

Value

Description

eDFR_All

0

All dates.

eDFR_Today

1

The current date.

eDFR_Today_Morning

2

The morning of the current date.

eDFR_Today_Afternoon

3

The evening of the current date.

eDFR_Yesterday

4

The day before the current date.

eDFR_Tomorrow

12

The date after the current date.

eDFR_ThisFullWeek

5

The entire week containing the current date.

eDFR_LastFullWeek

6

The entire week starting the week BEFORE the current date.

eDFR_NextFullWeek

8

The entire week starting the week AFTER the current date.

Note!

Note:
A full week starts on the Monday previous to the current date.

Code String

Value

Description

eDFR_ThisFullMonth

9

The entire month containing the current date.

eDFR_LastFullMonth

10

The entire month occurring the month before the month containing the current date.

eDFR_NextFullMonth

11

The entire month occurring the month AFTER the month containing the current date.

Note!

Note:
The full month starts on the first and ends on the last day of the month (the 30th or the 31st).

Code String

Value

Description

eDFR_LastWeek

13

The week (seven days) previous to and including the current date. For example, if today was 8/25, the last week would be 8/18 though 8/25.

eDFR_NextWeek

14

The week (seven days) after and including the current date. For example, if today is 8/25, the next week is 8/25 through 9/1.

Note!

Note:
The LastWeek and NextWeek strings contain seven days from (and including) the current date, so they don't necessarily start on Monday.

Code String

Value

Description

eDFR_LastMonth

15

The month previous to and including the current date. For example, if today is 8/25, the last month is 7/26 through 8/25.

eDFR_NextMonth

16

The month after and including the current date. For example, if today is 8/25, the last month is 8/25 through 9/24.

Note!

Note:
The LastMonth and NextMonth strings contain 30 days from (and including) the current date, so they don't necessarily start on the 1st or 31st of a month.

Encode a Default Start/End/Single Date Using Offset Notation

To use offset notation, you will need to create either a pair of parameters (CEODefStartDate and CEODefEndDate) or, for reports driven from only one date, a single parameter (CEODefSingleDate). The data type of these parameters will be a String.

Set the default value of each of these parameters to a string in the format: [+/-][#][m/d/yyyy/...]. For example, defining CEODefStartDate = -5d and CEODefEndDate = +12ww will generate a report with a start date of five days ago and an end date of twelve weeks from the current date.

The table below contains the set of strings which can be included as part of the above parameter string.

Setting

Description

yyyy

Year

q

Quarter

m

Month

y

Day of year

d

Day

w

Weekday

ww

Week of year

h

Hour

m

Minute

s

Second

Next Topic: Saving Crystal Reports in ServiceCEO

Back to Reports Table of Contents

Did you find this topic useful? Yes
No
I don't know
Why?