cancel
Showing results for 
Search instead for 
Did you mean: 

can we make one parameter optional?

Former Member
0 Kudos

Post Author: pvds

CA Forum: Data Connectivity and SQL

Hi everyone,

I have a report which has 2 parameters. According to the requirement if the user enters only one parameter and leave the other parameter blank(if he doesnu2019t wanted to enter or if he doesnu2019t know the value to enter) it should take only one parameter and filters the data according to that parameter only. The problem is that crystal is not letting me view the data unless I enter two parameters. Is there any other way to make the second parameter optional?

If u dint get my point I have an example

E.g.: I have two parameters called country and region. First parameter is country and second is region parameter. By this user can view the data filtered by country and specified region.

What if any other user wanted to view the whole country data with out specifying the region?

Can we make the region parameter optional? Is there any formula for that?

or

Is there any way to dynamically pass parameter to sql query?

Thanks in advance.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Post Author: pvds

CA Forum: Data Connectivity and SQL

wow it worked. but one of my report has date parameter and i tried the same if then statement but it is giving an error as string is required.

what i did is if {?Suspended Date} ="" then {Command.SUSPENDED_DATE} >" "else {Command.SUSPENDED_DATE} = {?Suspended date}

Thanks for the reply

Former Member
0 Kudos

Hi,

If it's a date field, you may need a dummy date, ex. 01/01/1900.

Heather

former_member184469
Contributor
0 Kudos

Crystal Reports 2008 has a new Optional Parameter feature where an end user can skip entering in a value for parameter. The report designer must designate which parameters are "optional" and also properly use formulas to handle what happens if a parameter does not have a value.

Former Member
0 Kudos

Post Author: RyanWamsat

CA Forum: Data Connectivity and SQL

You can write an if then statement in your selection options.if <parameter> = "" then {field.whatever} >= " " <--- There's a space there.This should return everything in that field.