cancel
Showing results for 
Search instead for 
Did you mean: 

Optional Parameter in Crystal Report XI designer

Former Member
0 Kudos

Hi,

Is there a way to have parameter as optional in Crystal Reports XI ?

I am okay to have the parameter shown but I dont want it to be mandatory.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I have added a new question

Former Member
0 Kudos

Another question to the same topic:

Is there a way to consider the selected parameter(s) while using optional conditions when you have more than one parameters added to the report.

like for ex: when u select the date parameter then u do the if check on it and bring the date from the records or bring date based on the entered values.

Hope this is clear

thanks again.

Former Member
0 Kudos

Let me see if I understand you correctly.

For example, you have two parameters one is of type string and another of type date. You have default values of 'z' for the string and '1900-01-01' for the date.

Your selection criteria would be something like this:


{
if {?parameter 1} = 'z' then
{database.field1} = {database.field1}
else {database.field1} = {?parameter1}
)
AND
(
if {?parameter 2) = date(1900,01,01) then
{database.date} = {database.date}
else
{database.date} = {?parameter 2}
);

Former Member
0 Kudos

Hi Sanjay,

Thanks so much, it worked fine !

Answers (1)

Answers (1)

Former Member
0 Kudos

In CR XI the only way to make a parameter optional is to assign it a default value.

For example:

If it is a date range parameter then give the date range parameter a default value say '1900-01-01'. Set this by editing the parameter and clicking on 'Default Value' in the options section.

Then, in your selection criteria have logic similar to this.

If minimum({?date parameter}) = date(1900,01,01)

and minimum({?date parameter}) = maximum({?date parameter}) then

{database.date} = {database.date}

else

{database.date} in {?date parameter};

If the users do not change the default value for the date range then it will pick up all records otherwise limited to the date range.

If it is a numeric parameter then assign a value of zero and for string perhaps 'z' (make sure the default value will never be equal to a DB value) and then in the selection criteria use:

If {?parameter} = 'z' then {database.field} = {database.field}

else

{database.field} = {?parameter};

Former Member
0 Kudos

Hi Sanjay,

Thanks for that useful bit of information and I see that it seems to work fine but not totally.

Please guide me here since the formula that I create does not quite seem to work as I want it to.

I have 1 parameter (String) and I did the exactly like this:

If {?parameter} = 'z' then {database.field} = {database.field} else {database.field} = {?parameter};

But how even if i have one more parameter which is a multi select it does not work like the above.

is this due to multiselect option.

Also how do we have these formulas created one below the other separated by a semi-colon or

have a OR or AND conditions?

thanks again!