Microsoft Report Builder: How to display selected chosen values from a multi-value parameter in a table? - reporting-services

I'm using MS Report Builder v3.0 to create a report. As part of this report, I have a multi-valued parameter (named #Diagnoses). The labels and some of the values (truncated by the size of the display boxes) of this parameter are shown below:
What I would like to be able to do is display the labels / values the user chooses in a 2-column tablix (I've tried using separate textboxes for the labels / values but the results are mis-aligned).
However, this does not appear to be straightforward. The closest method I've found is this one, which stores the user's choices in an internal parameter in xml format, then queries this parameter to produce a dataset from the xml.
So, I created the xml-producing internal parameter like this:
...and I've created a dataset based on this data, with the following query:
But now when I put these values into a tablix, the labels and values are now on separate rows, like this:
Does anyone have a straightforward way of sorting this out?
Best Wishes
C J

OK - I've solved it (it's not pretty, but it works!)
Basically, the problem comes from having to use the join statement when creating the xml - you can't really put both the label information and the value information on the same row in the xml.
To get round this, you have to use two internal parameters to create two datasets - one for the labels column, one for the values column. The method for creating these is essentially the same as that shown above, except for the values parameter, the expression for the default value is:
...and for the labels parameter, it's this:
(by the way, make sure you set the available values to "None" for internal / hidden parameters - the expressions here are for the default values)
Then, when you create the values dataset, you use the following syntax in its query:
...and similarly for the labels dataset.
Finally, in the report, you create one matrix from each of the two datasets, then put them next to each other, using fixed row heights and setting "can shrink" / "can grow" to false so that they look like they're in the same table:
I hope this helps somebody!

Related

SSRS: Toggle Report via a parameter

I'm creating a single SSRS report that is composed of data drawn from different Datasets. What I'm wanting to do is have a drop down menu where the user selects the dataset they wish and have the appropriate table turn on and show them the dataset information.
Right now I'm testing with two tables and in there Visibility property I have the following expression:
=IIf(Parameters!AppSelection.Value = "STRAW", false, true)
The other table has the exact same line in the same place but with a different value between the quotes.
With my parameter, I created a new one and called it AppSelection and gave it 2 Available Values that matched the words between the quotes in my above expression. The data type for my parameter is Text and the Value of the each Available Value is left at null.
When I preview my report and select the different values in the parameter, nothing happens. What is it I'm doing wrong?
Change the null in the available values to your text, ie STRAW.
You may find that the tables show the other way round from expected, switch the true and false.

Enable Selection of only two values in SSRS multiple select parameter

I have a SSRS report in which i have a parameter which comes in a dropdown it is a multiselect parameter, now i want that at most user should be able to select only two values from the dropdown.
Although you can't stop the user from selecting more than two values, you can keep the report from being shown if they do. First, I created a red-text textbox at the top of my report that holds an error message. Something like:
You selected more than two values for ReportParameter1, try again...
Then, I set the visibility of this message with an expression (for hidden) set to =(Parameters!ReportParameter1.Count<=2). Now this error will show only when the user has selected more than two parameters.
I then hide the content of my report with a visibility expression of =(Parameters!ReportParameter1.Count>2). Note that you can simply put all your content in a rectangle and then hide the rectangle.
If your user selects more than two parameters, only the red error message is shown. If they select two or less, everything looks normal. I would also write your stored procedure in a way so that if a user selects too many values for the parameter, it won't return any data.
This is not possible. A multi-select parameter is that and just that: a parameter that lets you select multiple values.
If you will always only have two values that need selecting, the easiest way of implementing this would be to have two single value parameters labelled as Value 1 and Value 2 which are then both referenced in your report query.
There are workarounds as suggested by #Kyle Williamson in his answer, but there is no exact answer possible as this facility is not present in SSRS

How can I append the results of additional queries to an SSRS report?

I am generating an SSRS report whose results are displayed like so:
I need to append similar query results (same exact query, one different parameter value) to the right of this data, so that one additional result set of data (from a 2nd query) would look something like this (but with different data, of course - this is just copied-and-pasted to show what's needed):
How can I add multiple of these similar-but-distinct result sets so that they can be read from left to right as shown above?
Solution: COLUMN GROUPING
If I have understood your question correctly, you are expecting to show those 3 columns repeatedly for different set of values. All you need to do is put those 3 columns in a group (Column Group) and Group by on whatever "Field/Parameter" you want to it repeat. Let me know how it goes!!
Based on what is written here, this is how I accomplished this:
I created a new report based on the existing one, and then added a Subreport and then dragged the existing (original) report onto it (I dragged "VariancePricebyProduct_Facelift.rdl" onto the subreport in "VariancePricebyProduct_Facelift_WithSubreports.rdl"). Then I selected the context menu item "Subreport Properties" and added a parameter ("Unit"), providing it with a "hard-coded/baked-in" value ("CHOPHOUSE") different from the one to be provided by the user for the main report.
Then, since I want to keep the same date values from the existing report, I added two more parameters to the subreport and set them to use the same values for the date range as those used there in the main report by selecting the "formula" ("fx") button and 2-clicking the appropriate parameter to be used as the passed-in (tramp) value:
That works. Just to make it plainer, here is how it looks at design time:
The mess at the top is "VariancePricebyProduct_Facelift.rdl"; the bit below is a Textbox/Label for the subreport and then the subreport itself.
And here is how the data looks where the original/base report finishes and the subreport begins:

SSRS: How to use same dimension & hierarchy for 2 parameters

So, I'm stuck on how to resolve this issue.
I would like to use the same Dimension & Hierarchy two times.
The dimension and Hierachy is already used one time to exclude a column value.
Now I would like to add a parameter to the same hierachy/dimension (with acfource the earlier rule applied)
And I can't get my head around to solve this.
If I'm understanding your issue correctly, then the solution is fairly simple. For each parameter that requires a dropdown list you need a different dataset in your report. For the first parameter (#p1), set available values and labels based on the result of a query.
In the dataset for the second parameter (#p2) which should have a filtered dropdown, have a second dataset that will be used to set the available values and labels of the second parameter. In this dataset, you want to reference the value of #p1 somewhere in your query. Upon opening, the report will generate the results of the first dataset to populate the first parameter's dropdown list. Once a value has been selected for #p1, the report will generate the second dataset to populate the options for the #p2 dropdown list. In this way, you can dynamically filter the options available to the dropdown list for the second parameter.

SSRS: is there a way to display a multivalued parameter in a table?

Using SSRS 2012
I have a multivalue parameter in a report and I would like to make it the source of a table. Is there a way to accomplish this? I'm coming to the conclusion that one cannot make the data source of a table anything except a dataset.
I tried to make the multivalued dataset (source of parameter) filtered by parameter but that gives a forward reference error (makes sense).
I am now trying to set the visibility property on the table's single text box like this, so it will only make the values visible that are one of the chosen parameter values:
=IIF(Fields!MODALITY.Value = Join(Parameters!Modalities.Value,","),True,False)
but they are all shown (alway true?). Any ideas on how to show a list of the values picked from a multi valued parameter in the report as a table (not just a delimited string in a text box)?
The data source of a table will always be a dataset, but you can use the parameters in a dataset. Something like
select * from dbo.split3(#parameter)
where split3 is a csv to table function, like one found on http://blogs.msdn.com/b/amitjet/archive/2009/12/11/sql-server-comma-separated-string-to-table.aspx
I found an expression that works for changing visibility so that my table shows just the elements in the multivalue parameter that were selected. Perhaps there's an easier way.
=IIF(Instr(","+Join(Parameters!Modalities.Value,",")+",",","+Fields!MODALITY.Value+",") <> 0,False,True)