all groups > sql server reporting services > july 2006 >
You're in the

sql server reporting services

group:

Parameters in an expression



Parameters in an expression randscott
7/12/2006 10:20:01 AM
sql server reporting services: I am trying to write an expression based on a parameter for a text box.
If I write it without the parameter it works fine, but when I add the
parameter, the expression evaluates as just text.

My dataset contains a field called "PeakSessions"
I have a parameter called "chrt", type string, containing the value
"PeakSessions".

=Fields!PeakSessions.Value <= Works fine. Displays the PeakSession
data.

="Fields!" & Parameters!chrt.Value & ".Value"

This parameterized version evaluates to: Fields!PeakSessions.Value.
So it seems the parameter resolved correctly, but my expression is
being evaluated as text. What am I doing wrong?

SQL 2005 Reports Services, SP1, Standard Edition
Re: Parameters in an expression randscott
7/12/2006 11:33:11 AM
You are right. I was just creating text, but I couldn't figure out the
right way. I had tried something similar to your suggestion
=Fields!(Parameters!chrt.Value).Value but the extra exclamation point
caused me problems. Your way worked. Thanks!


[quoted text, click to view]
Re: Parameters in an expression Bruce L-C [MVP]
7/12/2006 1:15:39 PM
You are just creating a string. Let's say you were trying to create a string
to display. This is how you would do it. RS will not evaluate the string
which is what you are trying to do. You should be able to do something like
this:

=Fields(Parameters!chrt.Value).Value

Just a guess.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

Re: Parameters in an expression Bruce L-C [MVP]
7/12/2006 2:24:53 PM
Good. Glad it worked.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

AddThis Social Bookmark Button