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

currentdate as default parameter

Status
Not open for further replies.

21128

Programmer
Aug 27, 2009
36
0
0
US
I have a parameter named {?EndDate}
when i run the report i want it to set it the current date as its default value, so that the value of {?EndDate} will be the day that report is run. Is it possible?
 
It should be. How are you using the parameter? And what version of Crystal Reports are you using?
 
why dont you just not use the parameter and use currentdate instead?



_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
If you only want the value to be currentdate when no other enddate is chosen, then set up a default value that is out of range, e.g., 9/9/9999, with prompt text that states that if 9/9/9999 is selected the end date will be the currentdate. Then use a selection formula like:

(
(
{?Enddate} <> date(9999,9,9) and
{table.date} < {?Enddate} + 1
) or
(
{?Enddate} = date(9999,9,9) and
{table.date} < currentdate + 1
)
)

-LB
 
hi LB
Thank you for your response.
It works perfect.
What if i have a parameter {?StartDate} and i want it to set it as default i.e {?EndDate}-1 or a day before CurrentDate? How the Selection Formula looks like?

Thankx
 
The following should either accept the selected start date or if 9/9/9999 is selected, it would default to >= the value of the end date (the selected date or current date) - 1:

(
(
{?StartDate} <> date(9999,9,9) and
{table.date} >= {?StartDate}
) or
(
{?StartDate} = date(9999,9,9) and
(
{?EndDate} <> date(9999,9,9) and
{table.date} >= {?EndDate} - 1
) or
(
{?EndDate = date(9999,9,9) and
{table.date} >= currentdate -1
)
)
) and
(
(
{?Enddate} <> date(9999,9,9) and
{table.date} < {?Enddate} + 1
) or
(
{?Enddate} = date(9999,9,9) and
{table.date} < currentdate + 1
)
)

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top