Search code examples
reporting-servicesssrs-2008ssrs-2012ssrs-tablix

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


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:

enter image description here

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:

enter image description here

...and I've created a dataset based on this data, with the following query:

enter image description here

But now when I put these values into a tablix, the labels and values are now on separate rows, like this:

enter image description here

Does anyone have a straightforward way of sorting this out?

Best Wishes

C J


Solution

  • 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:

    enter image description here

    ...and for the labels parameter, it's this:

    enter image description here

    (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:

    enter image description here

    ...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:

    enter image description here

    I hope this helps somebody!