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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Parameters - can you select default date?

Status
Not open for further replies.
Jul 17, 2003
66
US
Using Crystal 8.0.

Most of my reports use a date range parameter, usually first and last day of the month are selected. Is there a way to have the beginning and ending dates in the range default to the first and last day of the current month? Now they both the start and end dates default to the current day's date.
 
You could try a record selection formula like:

if minimum({?daterange}) <> currentdate or
(minimum({?daterange}) = currentdate and
maximum({?daterange}) <> currentdate) then
{table.date} in {?daterange} else
if minimum({?daterange}) = currentdate and
minimum({?daterange}) = maximum({?daterange}) then
{table.date} in date(year(currentdate),month(currentdate),01) to
dateserial(year(currentdate),month(currentdate)+1,01)-1

However, this will not pass to the SQL statement, i.e., it might slow your report.

-LB
 
I just tested it and you are right. The date parameters do not show up in Database->Show SQL Query meaning that ALL records will be selected thereby slowing the process down
 
you could use
{table.date} = LastFullMonth

That seems to reduce the number of records required. There is also a MonthtoDate function but not one that will pick up future dates in the month.

Editor and Publisher of Crystal Clear
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top