Show Parameter Selection on Page Header

My first day using Reporting Services.

I have a report parameter that has the following properties:
Name: Region
Multi-value
Available Values = From query
Label/Value examples:
East/4160
North/869
South/6185
West/5315

The report Page Header needs to show the region(s) selected in a textbox named "SelectedRegion" and the body has a table that shows the filtered data from a stored procedure.

What is the best way to populate the SelectedRegion textbox with the Region name(s)
selected from the parameter   For example, if the user selected the East and South regions, SelectedRegion must show "East, South" even though there may not be any data for the East region.



Answer this question

Show Parameter Selection on Page Header

  • *Lysander*

    Be careful, if you choose the same query result column for both Label and Value, then the .Label property is blank, even in a single select parameter, so be carefull when you use it :-)

  • tnec

    Ah - just discovered the answer to my own question. I'm sure others are going to want to know this:

    Parameters have a "Label" property that the expression builder doesn't show you. So to display the label value of, say, a "Product" parameter, you can use Parameters!Product.Label.

    So if you want to display all the selected values of a multi-valued "Product" parameter, you can use Join(Parameters!Product.Label, ", ").

    Hope this helps someone else.


  • Krams

    Zoran Pecenovic wrote:
    Be careful, if you choose the same query result column for both Label and Value, then the .Label property is blank, even in a single select parameter, so be carefull when you use it :-)

    Good to know! Thanks, Zoran.


  • emz chisnky

    If you change a report parameter to be multi-value, the .Value property will return an object[] rather than an object. Hence you can no longer e.g. write expressions like =Parameters!Region.Value

    In the page header, you can use expressions like this to create a comma separated list of the selected parameter values:
    =Join(Parameters!Region.Value, ", ")

    Other options:
    =Parameters!Region.Count
        returns the number of values in the array
    =Parameters!Region.Value(0)
        returns the first selected value
    =Join(Parameters!Region.Value)
        creates a space separated list of values

    See also MSDN:
    * http://msdn.microsoft.com/library/en-us/vblr7/html/vafctjoin.asp

    -- Robert



  • mediaman

    Thanks, Robert.  I used the Join expression and it works like a charm!
  • AdLearning.Net

    Hi Robert,

    This does indeed work, but it obviously gets me a joined list of the *values* selected by the user, rather than the displayed text in the parameter box.

    For example, if my parameter uses ProductName as its displayed text, but ProductNumber as its value, I want to display the name (ProductNumber will have no meaning to the user).

    Is that possible Even with single-valued parameters I was hoping there'd be a Parameters!Product.DisplayText property ...

    Cheers,
    Matt


  • Show Parameter Selection on Page Header