In an SSRS report expression, is there any way to refer to the "Hidden" property of a ReportItem?
More specifically: my SSRS report consists of a summary, with a subreport containing detail. I'd like to be able to stop the subreport running if it's hidden, as in this question. The answer to that question recommends changing the query based on a parameter, but my problem is how to set that parameter. Actually, I only need the parameter to be 1 or 0; the query will just return nothing if it's 0, and that's good enough.
I'd like to be able to show or hide the subreport using a textbox as a ToggleItem, and have an expression as the parameter value that goes something like this:
=iif(ReportItems!SubReport1.Hidden=False, 1, 0)
...or this:
=iif(ReportItems("SubReport1").Hidden=0, 1, 0)
...but the "Hidden" property doesn't appear for either.
Other options I've explored:
- Putting in an invisible text box, and using its value in the parameter expression as per this MSDN article. The problem then becomes how to set the value of the text box.
- Using a variable; same problem applies (actually I'm not even sure how you use variable in SSRS, or even if you can).
- Keeping the subreport as a separate report, and linking to it; a bit inelegant, and means losing the other report content when the user wants to see the detail.
- Extensive Googling; returns a lot of ways to set the "hidden" property, but no way to reference it.
Suggestions, moral support, constructive criticism and barefisted abuse all gratefully received.