Groups | Blog | Home
all groups > sql server reporting services > july 2005 >

sql server reporting services : 2005: displaying multi-select parameter values in a text box


Machelle
7/26/2005 4:13:02 PM
I am using Reporting Services 2005. My parameter is a multi-select one. I
want to display what parameters the user chose when they run the report so
others know what data the report was filtered by. When I put the below text
string in a text box, I get an error. When I put the index value after the
string it shows that item if there is one for that index #, and an error if
there isn't. If they chose 5 items for that parameter, I want all 5 to show
up automatically and not have to put the index number for each one to display
it.

=Parameters.pState.value (this gives a query error)
=Parameters.pState.value(3) (this displays the value of the 4th parameter
value they chose. If they didn't choose 4 parameters, then it gives an array
out of bounds error)

If they chose 4 items, I want a piece of code that will automatically show
all 4 (e.g. AZ, NM, NY, FL)

Robert Bruckner [MSFT]
7/26/2005 7:32:41 PM
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!MVP1.Value.ToString().

To access individual values of a multi value parameter you can use
expressions like this:
=Parameters!MVP1.IsMultiValue
boolean flag - tells if a parameter is defined as multi value
=Parameters!MVP1.Count
returns the number of values in the array
=Parameters!MVP1.Value(0)
returns the first selected value
=Join(Parameters!MVP1.Value)
creates a space separated list of values
=Join(Parameters!MVP1.Value, ", ")
creates a comma separated list of values
=Split("a b c", " ")
to create a multi value object array from a string (this can be used
e.g. for drillthrough parameters, subreports, or query parameters)

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


Hope this helps,
--
Robert M. Bruckner
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.

[quoted text, click to view]

Machelle
7/29/2005 11:04:03 AM
Thank you Robert. You are a God among men! This was SO helpful...

[quoted text, click to view]
AddThis Social Bookmark Button