all groups > sql server reporting services > september 2004 >
You're in the

sql server reporting services

group:

Parameter with expression for default showing as "disabled"



Parameter with expression for default showing as "disabled" rdcpro
9/30/2004 5:55:03 PM
sql server reporting services: When I create a parameter and specify a default value using an expression,
the control appears disabled, even though the default value is correctly
applied. For example, I have a boolean set of radio buttons, that should
default to true if the report is in a certain folder, and false in all other
locations. My expression for the default value of "Param1" is:

=iif( Globals!ReportFolder = "/Path/To/Folder", true, false)

But the parameter appears disabled until a postback occurs. So, if I enter
a value in any other parameter, then click to another parameter (so that a
postback occurs), then the radio button suddenly appears fine.

I'm thinking this is a RS bug, but is there a workaround?

Thanks in advance,
RE: Parameter with expression for default showing as "disabled" rdcpro
10/1/2004 12:15:03 PM
In case others run into this issue, I wanted to post my resolution.

At issue is the fact that a report parameter with an expression is assumed
to be dependant on another report parameter, even when in fact it's only
dependant on a global value or even if it simply uses an expression to return
a scalar result. So, when you set a default value using an expression, the
control is "disabled" and there is no way for the user to physically set the
control without first entering a fake value in another field, then causing a
postback to "refresh" the parameter. Only then can the user set the value
for the parameter using an expression. Of course, before the user runs the
query he/she must remove the "fake" value.

Evidently, the behavior is "by design" inasmuch as RS isn't smart enough to
realize there is no dependancy for this parameter, and there is no way in the
report designer to declaratively state as much.

In my case, I simply wanted to set the default value of the parameter to
"true" in one folder, and "false" in another. My solution was to use the
same approach that creating a linked report would use. Upload the report
with no default value on the control, then in the Report Manager, manually
specify the default value I want (either true or false) in the Properties >
Paramters page.

It would be really nice if there was a similar option in the Report
Designer, or if you could set the default to a scalar value directly the same
way you can for a drop-down parameter!

Hope this helps someone,
Mike

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