Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide Empty Subreport in SSRS2008 R2

I have added a subreport to my report. The aim is simply to hide the subreport if there is no data in it.

NoRows property was mentioned on this thread on Microsoft forums, but I guess it is for SSRS 2005 as the thread as quite old.

Isn't there any obvious way to hide subreport if there is no data in it? I could hide the tablix in the subreport itself, but I also need to hide the row where subreport placed. To do this I need an indication whether the subreport has data or not in the main report.

Could you give a clue to sort this out?

like image 970
AnarchistGeek Avatar asked Feb 01 '12 09:02

AnarchistGeek


1 Answers

I had a similar problem a year ago or so. My vague recollection of this:

The default behavior as I recall was that SSRS won't show the subreport if the datasets in the subreport return no rows. This accomplishes half of what you want, but doesn't let the parent report know whether to hide the subreport area or not. IIRC, the NoRows property only controls what will be shown in this case, but it's not easily checked at run-time to change other properties.

My final solution was to create a stripped down query in the parent report that would indicate whether or not the sub report would have any rows. I used this to control row and subreport visibility.

I suspect there's a more elegant answer...

like image 58
Jamie F Avatar answered Sep 20 '22 00:09

Jamie F