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

RE: Disable parameter based on another parameter

Status
Not open for further replies.

allyne

MIS
Feb 9, 2001
410
US
Hello,

I'm not sure if this is possible but I have a parameter that you can either select "Anes" or "Sur". What I would like to do is that if "Anes" is selected then show the Parameter {?Anes} and if "Sur" is selected then show {?sur}. I would need to do this within Crystal as a formula etc.

Thanks Much!
 
You can set up a record selection formula like this:
(
(
{?Which}="Anes" and
{table.anes}={?Anes}
) or
(
{?Which}="Sur" and
{table.sur}={?Sur}
)
)

Only the values for the selected parameter would affect the report results, but you would still need to make a selection for all three parameters, so you might want to add a selection "All" for each (or 0 for a number, with "All" as a description field), so that the selections make sense to the user. More recent versions of Crystal have "optional" parameters, so you might want to look at that functionality.

-LB

 
Hi LB,

Thanks for the quick response! This works but I would like to take this 1 step further. Using your suggestion I'm getting 2 parameters in the panel. One for {?Sur} and one for {?Anes}. What I would like to do is have only 1 parameter within the panel so if
{?Which}="Sur" the only show {?Sur} in the panel or if {?Which}="Anes" then only show {?Anes}. Is this possible?

Cathy
 
Hi LB,

I figured it out. I needed to add a calculated field to my query so If it field name like Anes then "Anes" else "Sur".

I then created a cascading parameter that if you select "Anes" then it shows the records for "Anes" else it show the records for "Sur".

Thanks for your help!
 
You could create a union command that combine both Sur and Anes fields into one to populate the values in one parameter, e.g., {?SurOrAnes}. The user would still choose {?Which} and then select from the combined list. If they included both kinds of fields, only the selected field would be populated based on your record selection formula

(
(
{?Which}="Anes" and
{table.anes}={?SurOrAnes}
) or
(
{?Which}="Sur" and
{table.sur}={?SurOrAnes}
)
)

Another option is to write the command so that only one set of values is returned by adding the Which parameter into the where clause within each side of the union command. Then you would set up the {?SurOrAnes} parameter as a dynamic one based on the field in the command. However, when you set the field from the unlinked table to the {?SurOrAnes}, there will be two prompts, first for the {?Which} and then a second screen will appear with {?Which} and {?SurorAnes} which will populate correctly--BUT you will have to manually change the {?Which} parameter to match your earlier selection. Neither approach is particularly intuitive.

If you decide to go one of these routes, let me know if you need help with the union command.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top