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

Crystal XI - Current Date in Date Parameter

Status
Not open for further replies.

sardine53

Programmer
Jul 4, 2003
79
US
I am new to CR XI and am working with CR XI and a SQL database.

I would like to default the current date in a date parameter (as in v8.5) and I don't see an obvious way to do that:

{TABLE.ENTRYDATE} >= {?StartDate} and
{TABLE.ENTRYDATE} <= {?EndDate}

{?StartDate} and {?EndDate} should both be the current date.

Any help would be greatly appreciated.
 
In each parameter setup screen, add a default date like 9999-09-09. Then in the record selection formula use:

(
if {?startdate} = date(9999,09,09) then
{TABLE.ENTRYDATE} >= currentdate else
if {?startdate} <> date(9999,09,09) then
{TABLE.ENTRYDATE} >= {?startdate}
) and
(
if {?enddate} = date(9999,09,09) then
{TABLE.ENTRYDATE} <= currentdate else
if {?enddate} <> date(9999,09,09) then
{TABLE.ENTRYDATE} <= {?enddate}
)

-LB
 
Thanks so much LB - it works great.

I don't suppose there is a way to actually place the current date in the parameter so the user sees "2005-12-14" rather than "9999-09-09"?

Otherwise, I'll have to just have to explain it in the prompt text.
 
If there is, I haven't figured it out. Sorry.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top