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)
thanks in advance!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.
"Machelle" <Machelle@.discussions.microsoft.com> wrote in message
news:2BE1BECC-8CDC-4C0A-9735-0CB291BDD301@.microsoft.com...
>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)
> thanks in advance!|||Thank you Robert. You are a God among men! This was SO helpful...
"Robert Bruckner [MSFT]" wrote:
> 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.
> "Machelle" <Machelle@.discussions.microsoft.com> wrote in message
> news:2BE1BECC-8CDC-4C0A-9735-0CB291BDD301@.microsoft.com...
> >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)
> >
> > thanks in advance!
>
>
No comments:
Post a Comment