SAP Knowledge Base Article - Public

1517565 - How to Create 'Optional Number Parameters' in Crystal Reports XI R2

Symptom

When creating static parameters in Crystal Reports XI R2, we do not have an option to set up the 'Number' parameters as 'Optional'

Environment

Crystal Reports XI R2

Reproducing the Issue

  •  Create a sample Crystal Report against the Xtreme Sample Database
  •  Create 4 static parameters - Customer ID, Customer Country, Customer Name  and Order ID
  •  We would like to setup Customer Country, Customer Name and Order ID 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

1) Create the static string parameters as you normally would
2) When creating the number parameter, set 'Default Value' as '0'

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} 
)

and

(
 if {?OrderID} = 0 then true
 else
 {Orders.Order ID} = {?OrderID} 
)

 

Save the formula and refresh the report. Now Customer ID would be the only parameter that needs to be entered, and you can see that the report will run without the other parameters as well.

See Also

1517536 - How to create Optional Parameters in Crystal Reports XI R2

Keywords

Optional Number Parameters, Crystal Reports XI R2 , KBA , BI-RA-CR , Crystal Reports designer or BusinessViews Manager , Problem

Product

SAP Crystal Reports XI R2