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

Parameter Lookup base on other Paramenter selection 1

Status
Not open for further replies.

cazellnu

Technical User
Aug 15, 2002
41
CA
If I had setup two parameters and its default values are pull from the database (i.e. first parameter is Country and the second parameters is city). I am curious if it is possible to write a formula somewhere in the report so the lookup in the second parameter will limit or even control by the first parameter.
 
Not in Crystal, in fact what you believe to be happening isn't.

Parameters are NOT dynamic, once you bring in the data from a field, it does NOT get refreshed, which is VERY annoying to most.

There are third party solutions, or you can write code in an external language to accomplish this.

Check out Ido's solution:


-k
 
SynapseVampire is correct, but you can develop a report so that it sort of mimics one parameter controlling another. For example, {?city} will pull in all cities of interest if used in the select statement. You could set up a second parameter that asks whether to look at the city or country level, e.g., {?geoglevel}. Then create a formula {@geoglevel}:

if {?geoglevel} = "Country" then
(if {city} in ["Boston","LA", "St.Paul","Houston"] then "USA" else
if {city} in ["Toronto", "Montreal","Quebec"] then "Canada" else "Other Country") else

if {?geoglevel} = "City" then {city}

You could also set this up using a select-case statement, if that's easier.

You can group on this, so that Group 1 and related summaries will be either at the city or country level, depending on {?geoglevel}.

You can also use parameters to make your report a detail one or a summary one by using a third parameter {?reportlevel} (summary or detail) and conditionally suppressing detail sections and page headers, etc., using {?reportlevel} = "Summary".

In other words, you can still do some interesting things with parameters, despite the limitations.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top