Print Page | Close Window

Parameter with several choices does not work

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=15856
Printed Date: 30 Apr 2024 at 2:14am


Topic: Parameter with several choices does not work
Posted By: Piinutti
Subject: Parameter with several choices does not work
Date Posted: 12 Mar 2012 at 3:15am
Hello.
I am trying to get to work a parameter in which you can choose the options you need for example what is the state of the purchase order..
I have made the parameter but it does not separate any data.. So it does not work.
What I am doing wrong?

Below you can see a picture about the parameter. You should be able to select all of the values or maybe just one of them.




Replies:
Posted By: Gurbs
Date Posted: 12 Mar 2012 at 3:50am
Did you already created a formula in your record selection, linking your paramater to a field in your dataabase?


Posted By: lockwelle
Date Posted: 12 Mar 2012 at 8:56am
CR selects them as an array of values...to check if what you want is in the selected values you would use something like:
{table.field} in {?parameter}
 
check help for arrays for more syntax.


Posted By: Piinutti
Date Posted: 12 Mar 2012 at 8:51pm
Thanks for fast reply..
Of course I forgot to create the formula...
I am newbie with the Crystal Reports..


Posted By: Piinutti
Date Posted: 12 Mar 2012 at 10:58pm
I have now created the formula for the parameter but it still does not give me the right results. It doesn't limit the data in any way..
I tried the lockwelle's way but that didnt work. I also tried the Join ({parametername},",") formula.. That either does not give me any results..
I am quite sure that the fields in parameter are the right ones.. Is there anything else I can do?


Posted By: DBlank
Date Posted: 13 Mar 2012 at 4:02am
there are formula fields that you create in the field explorer which can be used to manipulate data and display it in the report canvas.
There is also a Select Expert (the button with a hand selecting a red circle from 2 blue circles) which is where you create a boolean formula to determine if a row should be included (true) or excluded(false) in the report.
The suggestions for the formula were intended to be used in the select expert.


Posted By: kostya1122
Date Posted: 13 Mar 2012 at 6:39am
i would suggest trying

{table.field} like "*"+{?parameter}+"*"

or
{table.field} = trim({?parameter})


Posted By: Piinutti
Date Posted: 13 Mar 2012 at 8:18pm
Does it make difference that the field from which I am trying to get the data, is a pull-down menu? I am going to try the kostya's way now to see does it make a difference in results..


Posted By: DBlank
Date Posted: 14 Mar 2012 at 5:02am
from your screen image i assume you are aware that the actual value that is being used for comparison is 1,2,3,4 or 8 as a string.
so if you use
table.field = {?parameter}
it is expecting that table.field is a string data type with only 1,2,3,4 or 8 in it.
 
also are you inserting this in the select expert or into a  formula field?
 
If you have been inserting it into the select expert I would have expected that it would have returned 0 records (if it is is written incorrectly) rather than having no impact on your record selection as you are describing.


Posted By: Piinutti
Date Posted: 14 Mar 2012 at 8:09pm
The meaning of this parameter is that it allows us to select purchase orders by its state (confirmed, open, invoiced etc)from a pull-down menu. So with the parameter we should be able to select one or more of these values. And the results should be the purchase orders which are for example invoiced, not the other ones (for example confirmed or delivered, only the invoiced). Now I am getting all of the purchase orders as a result. This parameter does not limit the results any way. And it is frustrating.
I have inserted in formula field and then I have inserted the formula into the report. I haven't tried to insert into select expert.
I hope this clarified what I am trying to do here.. I am such a newbie with the CR...


Posted By: Piinutti
Date Posted: 15 Mar 2012 at 2:39am
I have tried several tricks to get this parameter to work. I tried to make the array for this and now I have this error message when I try to use the report.

Have anyone a way how to make a array from already existing values? (These come from already existing table and field). I think that is the problem now. I don't have any tricks in my sleeve anymore..





Posted By: DBlank
Date Posted: 15 Mar 2012 at 4:00am

creating a formula field has NO impact on record selection (unless it is enforcing a join that was not already enforced).

As I stated earlier you have to write a select statement (a boolean formula) inside the select expert to do this.
 
putting
table.field = {?parameter}
into the select expert will limit the rows to whenever this evaluates to TRUE
this will only evalaute to true when the table.field (your database field) has as string (text) value = to any string value (1,2,3,4 or 8) entered into your parameter at run time.


Posted By: kostya1122
Date Posted: 15 Mar 2012 at 5:27am
i think that maybe your parameter is not set up correctly
inside your parameter try replacing your 1-8 values that you have in 
Value column with the values that you have in your
description column.


Posted By: Piinutti
Date Posted: 16 Mar 2012 at 1:48am
Thank you guys for the help. I have now managed to get the parameter work properly. It is now working just as I wanted.



Print Page | Close Window