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

Select "ALL" Parameter Values and pass them 3

Status
Not open for further replies.

ciscowiz

MIS
Apr 21, 2004
146
US
I am using crystal 9 with a VB.NET Front End to load and view reports. I have a report with 2 parameters, a date, and a String. The string Parameter is "PRODUCT" and has 2 values to choose from, A or B. However, I want the user to be able to pass in A AND B in addition to A or B. Basically I will have a Dropdown list with A,B, and a *. If the user selects A or B obviously the PRODUCT parameter will be set to that particular value. But what do you do when you want the parameter to hold both values? I am guessing you need to allow for multiple values on that parameter but within the designer the interface seems very clunky as far as "adding" and "Deleting" values before you pass them. Its almost like you can have "A" equal "A", "B", or "A" "B" but I want "A" to be "A", "B" to be "B" and the wildcard * to be A AND B. I am sorry if this is confusing I would be more than happy to clarify if need be. Any info or methods on how to accomplish this would be appreciated.

Thanks,
Bryan
 
Hi,
Ypu need to code the criteria ( the record selection formula) to handle the possible choice of both ( that is, all) values, something like:
Code:
If {ParamProduct} = 'ALL'
 then
True 
else
If {ParamProduct} = 'A' 
then
{Table.Field} = 'A' 
else 
If {ParamProduct} = 'B' 
Then
{Table.Field} = 'B'

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Thanks again Turkbear, Looks easy enough BUT

If {ParamProduct} = 'ALL'
then
True

Why do you set the Parameter equal to TRUE and how does it being TRUE tell the report to use all the values?

ALSO, Am I supposed to check the "Allow Multiple Values" option for this parameter or is the Selection Formula basically taking care of that?

Thanks again for the quick reply!
 
You probably won't get that to pass the fitering to the database, check the Database->Show SQL Query

I'd recode it as:

(
If {ParamProduct} <> 'ALL' then
(
If {ParamProduct} = 'A' then
{Table.Field} = 'A'
else
If {ParamProduct} = 'B' Then
{Table.Field} = 'B'
)
else If {ParamProduct} = 'ALL' then
true
)

Should be right.

-k
 
Thanks synapse But I still don't see how if the parameter is set to TRUE it knows to pass both values but I will give it a try. Also, Do I have to set the parameter to allow for multiple values?
 
Hi,
As usual, synapse 's version is the one to use in most cases.


You do not need to set the 'allow multiple values' because you are only using 1 value ( A or B ) or None..




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Yes, set it to allow multiple values and add "All" as one of your parameter options, along with A and B. Then your formula just needs to be:

(
If {?ParamProduct} <> 'ALL' then
{Table.Field} = {?ParamProduct} else
If {ParamProduct} = 'ALL' then
true
)

-LB
 
Oops, yeah, I guess it doesn't have to be set to multiple values, but I do think the formula could be simplified as noted.

-LB
 
Sorry if this is a Dupe Post --

Thanks LBASS your code worked perfectly and I did not have to set the parameter to allow multiple values.
 
<laffin>

Yeah, LB was right, I didn't even bother to look at the code, just the layout to assure SQL pass through.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top