Symptom
When creating static parameters in Crystal Reports XI R2, we do not have an option to set some of the parameters as 'Optional'
Environment
Crystal Reports XI R2
Reproducing the Issue
- Create a sample Crystal Report against the Xtreme Sample Database
- Create 3 static parameters - Customer ID, Customer Country and Customer Name
- We would like to setup Customer Name and Customer Country as optional, however we do not have any predefined option to setup the parameters as optional
Cause
This functionality is not available in Crystal Reports XI R2. This has been implemented in Crystal Reports 2008 as an enhancement where the record selection makes use of the 'hasvalue()' function
Resolution
As a workaround we need to modify the record selection formula.
Once the parameters have been setup, create a record selection formula as follows:
{Customer.Customer ID} = {?ID}
and
(
if {?Country} = "" then true
else
{Customer.Country} = {?Country}
)
and
(
if {?Name} = "" then true
else
{Customer.Customer Name} = {?Name}
)
Save the formula and refresh the report. Now Customer ID would be the only parameter that needs to be entered, whereas all others would be optional.
See Also
1517565 - How to Create 'Optional Number Parameters' in Crystal Reports XI R2
Keywords
Optional Parameters, Crystal Reports XI R2 , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To