Monday, April 12, 2010

SSRS 2008: Disabling “Go to Report” action through expression

Have you ever come across a situation where you need to disable an action set to a series in Reporting Services? If so, you might know that Action property cannot be set with expressions. It has to be set through Series Properties and select either None or Go to report (or other). If you have the Action as  None, you cannot set it back to Go to report via an expression.

One of my colleges faced a situation where he had to disable the action based on a report parameter value. What he had done was, set the Action as Go to Report and had below expression in Specify a report.

   1: =iif(Parameters!Parameter1.Label="All", "", "NewReport")

This worked fine. It did not allow user to perform the action if the condition is satisfied. Problem arose when a tootip is set. If a tooltip is set to the series, it shows that action can be performed when the mouse is moved over, and leads to an error because it tries to open a report which has set with NO name. This can be sorted out too.

   1: =iif(Parameters!Parameter1.Label="All", Nothing, "NewReport")

This expression solved the problem. All I had to do is, replace the “” with Nothing.

2 comments:

Unknown said...

Awesome. You saved my time.

debadutta said...

It is awasome.
One question to ask is that, can we disable or enable a parameter writing any expression in SSRS 2008 R2.
For example:
I have 3 parameters.
Parameter1: Is a dropdown having values Week,Month,YTD.
Parameter2: Is a single selection. Having values like Year/wk. For example 2011/wk1,2011/wk2
Parameter3: Is a single selection. Having values like Year/Month. For example 2011/Jan, 2011/Feb.

I want to have initially the Parameter2 and Parameter3 is disabled. When I select "Week" from parameter1 then only the Parameter2 is enabled. And when "Month" is selected then the Parameter2 is disabled and Parameter3 is enabled.

Is there any way to do this writng any expression for this.

Please guide how to do this. I need this urgently.