Sunday, January 30, 2011

Crystal Reports : Displaying the starting and ending dates within a Range

This is an oldy but a goody and is always a popular question.

One of the incest things about Crystal Parameters is the ability to use a Range. That is, the ability to use a single parameter to represent both a Starting Date and an Ending Date. This also allows you to simply evaluate any date being IN said Range, without all the mucking about with "Greater Than or equal to", etc.

But with this ease-of-use (technically speaking), it becomes a little cumbersome to display the Starting or Ending date of the Range in question.

Let us suppose our Date Range parameter is called {?DateRange}.

We will need to create two Formula fields, one for each date;

Create a formula called {@StartingDate} and use the following text:
MINIMUM({?DateRange})

Now create a formula called {@EndingDate} and use the following text:
MAXIMUM({?DateRange})

You can then drag the Formulas onto the report as if they were String objects.

No comments: