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!

Can CR filter a parameter list, based on previous parameter?

Status
Not open for further replies.

quellcoder

Programmer
Jun 25, 2004
1
US
Can CR (8 or 9) filter a parameter list, based on what the user has selected for a previous parameter?

Typical scenario that is on just about every non-Crystal-Report report that has a Country and State: If a user picks "Country" of "USA", how do I make the "State" parameter list show only states for "USA"?

(Right now in the straight-forward CR parameter screen, it shows All the States for All the Countries).

Thanks.
Q
 
Ok,
I have never tried this and cant test it either without Crystal Reports so I do not know if this is possible, but..

Why not create both the parameters as per usual and then go into the SQL query and create a clever sub select statement in the where clause?

I will try this myself later on.
Good luck

JR
(In need of a cool signature)
 
Hello!

I have exactly the same problem. Have you found something?
I will try this morning to find a solution

Soso
 
Try this:

Code:
if {?param1} = true then 
    (if {?param2} = "ALL" then True else 
        {?param2} = {Field1})
else 
    (if {?param3} = 0 then True else
        currentdate <= {Field2} - {?param3})
//turn off or on daterange of days back, specific division

Just remember to set the default on the params you 'may' look at.

Scotto the Unwise B-)

 
That is a cool bit of coding.
Where would this apply? In the Select Expert?

Could you maybe explain what is happening in the code?
I cannot follow it, neither does it work for me....

Thanks

JR
(In need of a cool signature)
 
Crystal won't filter one parameter list based on another parameter.

As previously posted, there are 3rd party products to do this.

Scotto's suggestion could be used to filter data by placing it in the record selection formula based upon 2 parameters, but does not filter parameters. Also his solution probably won't pass the SQL to the database in that form.

-k
 
Hello

Which product to do that? The link from dgillz is broken.
Have you the good address to find it.

Thank you

Soso

PS: I tried many solutions (sub-reports, formulas, etc.) but it didn't work! I have allways all the fields of my table.
 
>That is a cool bit of coding.
>Where would this apply? In the Select Expert?
Yes.
>Could you maybe explain what is happening in the code?
>I cannot follow it, neither does it work for me....

I have 3 params defined.
Param1 is boolean, think of it as a flag which way to go
Param2 is a date here, a specific date I want to look at
Param3 is number here, how many days back I want to look if I am not interested in a particular date. Not an incredible example, but still viable.

Code:
if {?param1} = true then 
    (if {?param2} = "ALL" then True else 
        {?param2} = {Field1})
else 
    (if {?param3} = 0 then True else
        currentdate <= {Field1} - {?param3})

True 09/11/00 3 gives me data for 09/11/00
False 09/11/00 7 gives me data for 7 days back from today

Another way is to have one param override the other:

Code:
if {?param1} > 0 then 
    currentdate <= {Field1} - {?param1})
else
    (if {?param2} = "ALL" then True else 
        {?param2} = {Field1})

Same diff
Scotto the Unwise
--whose appellation comes from a distant time when he did something very bad to fileservers in CS1100 at UCF
B-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top