Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Diplaying dates from Date Range Parameter

Status
Not open for further replies.

terenceb

Programmer
Jun 10, 2003
77
US
Hi All,

I am writing in Crystal 8.5, pulling data from a SQL tables from a Cashe database. Today I need to display in my header the month and year(December 2003) from my parameter called (?Date Range). Also, How would I display the date range(from the parameter) in the header. For example 11/01/2003 - 11/30/2003.
 
Formula to display date range in header:
minimum({?DateRange}) & ' to ' & maximum({?DateRange});

Will your date range be limited to a single month? If so, use this formula to display the month and year:
MonthName(Month({@min})) & ' ' & toText(Year({@min}),0,'');
 
Note in the following formula:
MonthName(Month({@min})) & ' ' & toText(Year({@min}),0,'');

The '' as the last argument to the ToText function is actually two single quotes and not one double quote.
 
Thanks for your response. It is great to have help a key stroke away.

 
If there might be a change in month or year within your daterange, your header-formula could look like this:

if month(minimum({?Date Range}))<>month(maximum({?Date Range})) then
monthname(month(minimum({?Date Range}))) & ' ' & totext(year(minimum({?Date Range})),'0#') & ' - ' & monthname(month(maximum({?Date Range}))) & ' ' & totext(year(maximum({?Date Range})),'0#')
else
monthname(month(minimum({?Date Range}))) & ' ' & totext(year(minimum({?Date Range})),'0#');

Your display formula for the date range would be:
minimum({?Date Range}) & &quot; - &quot; & maximum({?Date Range});

You have to work with 'minimum' and 'maximum' as a range parameter will be an array in crystal reports.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top