Clif
asked on
Passing "All" Parameter Values from Visual Studio to Crystal Report
I have a report that I am serving up via a web page written in Visual Studio.
The report has several parameters which I am setting in code. One of the parameters, however, has the "Allow Multiple Values" flag set as "Yes". I want to be able to select all the values (the parameter is dynamic, so the values may change) as if the user had clicked the double arrow "Add All" button.
I've searched and have found many example of how to select one, two, or more values, but cannot seem to find a code example to select all the values.
TIA
The report has several parameters which I am setting in code. One of the parameters, however, has the "Allow Multiple Values" flag set as "Yes". I want to be able to select all the values (the parameter is dynamic, so the values may change) as if the user had clicked the double arrow "Add All" button.
I've searched and have found many example of how to select one, two, or more values, but cannot seem to find a code example to select all the values.
TIA
ASKER
The list of values comes directly from the query that will feed the report itself. I cannot add an "ALL" to that.
Can you add a check box to the parameter screen?
mlmcc
mlmcc
ASKER
To 200+ reports???
It seems to me there has to be some way of doing this other than rewriting/editing every report.
Is there a way of getting a list of available values from the report (Yes, I suppose I could query the view, but querying the report would be more accurate)
It seems to me there has to be some way of doing this other than rewriting/editing every report.
Is there a way of getting a list of available values from the report (Yes, I suppose I could query the view, but querying the report would be more accurate)
Do you have a separate parameter screen for each report?
Does selecting the first then moving down through the list and clicking the last one with the shift key held down select all?
mlmcc
Does selecting the first then moving down through the list and clicking the last one with the shift key held down select all?
mlmcc
ASKER
I don't think you understand what I'm looking for.
There is no parameter screen in this context (I do have a related but separate question elsewhere on EE that should not be confused with this).
In the report I have several parameters, the specific one I am having trouble with is one where the "Allow Multiple Values" flag set as "Yes". If this report is run within the Crystal Reports IDE, the parameter selection screen will show two list boxes. The left list box contains all the values available for the parameter. The right list box will contain the values selected. In between the two boxes are two buttons. The top button is a single arrow and will move the selected value from the left to the right. The bottom button is a double arrow and will move all values from the left list box to the right list box.
All that is if you're looking at the report from within Crystal Reports. But I'm trying to do this from within a web page.
In Page_Init, I have a line of code where the parameter(s) are set:
The problem is that this only sets the parameter to a single value. There is code out there which shows that I can replace "My Value" with an array to set several values to the parameter. However the examples I have seen presume that the values are known ahead of time and are a fixed number of values. I cannot use the examples, though, because the number of values may change and the values themselves may not be the same every time. I need some way to specify "add all". In other words act as if the double arrow had been clicked.
There is no parameter screen in this context (I do have a related but separate question elsewhere on EE that should not be confused with this).
In the report I have several parameters, the specific one I am having trouble with is one where the "Allow Multiple Values" flag set as "Yes". If this report is run within the Crystal Reports IDE, the parameter selection screen will show two list boxes. The left list box contains all the values available for the parameter. The right list box will contain the values selected. In between the two boxes are two buttons. The top button is a single arrow and will move the selected value from the left to the right. The bottom button is a double arrow and will move all values from the left list box to the right list box.
All that is if you're looking at the report from within Crystal Reports. But I'm trying to do this from within a web page.
In Page_Init, I have a line of code where the parameter(s) are set:
CrystalReportSource1.Repor tDocument. SetParamet erValue("P aram1","My Value")
The problem is that this only sets the parameter to a single value. There is code out there which shows that I can replace "My Value" with an array to set several values to the parameter. However the examples I have seen presume that the values are known ahead of time and are a fixed number of values. I cannot use the examples, though, because the number of values may change and the values themselves may not be the same every time. I need some way to specify "add all". In other words act as if the double arrow had been clicked.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I have access to the data source that feed the report, so I can (technically) get the list, put it in an array, and set the parameters that way.
I'm hoping there is some other (read: easier/less code intensive) method of saying "Select All"
I'm hoping there is some other (read: easier/less code intensive) method of saying "Select All"
I don't expect there will be Clif, crystal made it easy via their GUI, but they would have had to do the grunt work somewhere before invoking the stored procedure.
Alan ";0)
Alan ";0)
What version of Crystal?
If it is CR 2008 or 2011 you could make the parameters optional.
mlmcc
If it is CR 2008 or 2011 you could make the parameters optional.
mlmcc
ASKER
Ok, I ended up creating code that read the list of available values from the database and put them in an array to feed the parameter.
It works.
Thanks to all for trying. :)
It works.
Thanks to all for trying. :)
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for Clif's comment #a38363297
for the following reason:
If I graded in error, please point it out and I will try to correct.
Accepted answer: 0 points for Clif's comment #a38363297
for the following reason:
If I graded in error, please point it out and I will try to correct.
Sound like you followed/used the suggestion from alanwarren. I really think you should award points to his comment
mlmcc
mlmcc
ASKER
You know, I thought I had seen that, but somehow missed it when I came back to grade.
Sorry, it's corrected.
Sorry, it's corrected.
({?Parameter} = 'ALL' OR {?Parameter} = {YourFIeld})
mlmcc