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

How to make a third parameter optional?

Status
Not open for further replies.

jack91

Technical User
Apr 13, 2009
185
US
Hi,

I am using crystal reports v10.

I have 3 parameters , the third parameter is a date value. Users may not know what date to enter so they need not be compelled to enter a date.

I searched on tek-tips and I got this:

However, when I refresh the report and enter the first 2 parameters I am being prompted to enter the date (3rd parameter also). I am un-able to close this dialog box without entering any date value.

Please advise
Thanks
Jk
 
Just default it to say 01/01/1900.

In your select statement or formula where it is used set logic to ignore 01/01/1900.

Ian
 
How do i set logic to ignore 01/01/1900?

jk
 
I tried this:

(if {? Date} = DateTime('1/1/1900 12:00:00 AM') then IsNull({my parameter}) or
CDate({my parameter}) in (DateTime('1/1/1900 12:00:00 AM') to DateTime('1/1/3000 12:00:00 AM'))
else if {? Date} = DateTime('1/1/3000') then IsNull({my parameter})
else ({? Date} = Date({my parameter})))
 
BUT,

when i enter new parameter values for the first 2 parameters, I still get prompted for the 3rd parameter.

Thanks
Jk
 
YOU will still be prompted for the third Parameter but it will be defaulted to 01/01/1900. In your prompting text explain when users should leave as default.

Not sure what you are trying to do here

(if {? Date} = DateTime('1/1/1900 12:00:00 AM') then IsNull({my parameter}) or
CDate({my parameter}) in (DateTime('1/1/1900 12:00:00 AM') to DateTime('1/1/3000 12:00:00 AM'))
else if {? Date} = DateTime('1/1/3000') then IsNull({my parameter})
else ({? Date} = Date({my parameter})))

What is {my parameter} doing?

Ian
 
You need to set the default value in the parameter.

For using it, do a test like:
Code:
Year(@Param3) = 1900 or
{your.date} = @Param3
This should be 'True' - put it on the detail line to confirm it is working OK. You can also use it for selection, just by saying @Param3_OK.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
I was told by the DBA that 1/1/1900 is set to default to "ALL".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top