Hide a Rectangle in SSRS
Hi all,
I want to hide the Recatangle on SSRS ( i know this can be done with the visibility property but wasn't sure on how to achieve that in my case)
Ex: table1 , table2, table3 are the tables i have and there is an page which displays the names of these tables, so when there is no data i want to hide the index page which displays the names of these tables
index:
table1, table2, table3
i should not get the index page if there are no tables. Thanks (hope someone should ran into such case by now) your help is really appreciated!!
January 20th, 2012 5:55pm
Sounds like a fun one - seems like we're always trying to make SSRS behave more like a windows forms app then a report....
Anyways, I'm not sure what version of SSRS you are using, I'm on SSRS 2008 R2 and this worked for me.
Sample 1: (Each table is based on it's own dataset, and there aren't any table filters). On your Rectangle Hidden property do an Expression like this
=CountRows("DataSet1") = 0 ANDALSO CountRows("DataSet2") = 0 ANDALSO CountRows("DataSet3") = 0 <br/>
Sample2: (Each table has a filter, so the number of rows in the dataset and in the table don't match up). On each table put a texbox in the header - and hide the text box, and give it a meaningful name like txtTable1Rows, txtTable2Rows etc... - and
in each respective text box do a formula like
=CountRows() Or to be more precise, but you would have to change it in each table.... =CountRows("Tablix1")
Then in the Rectangle Hidden property do an expression like this
=ReportItems!txtTable1Rows.Value = 0 ANDALSO ReportItems!txtTable2Rows.Value = 0 ANDALSO ReportItems!txtTable3Rows.Value = 0
Hope that helps.
-Matt
Free Windows Admin Tool Kit Click here and download it now
January 20th, 2012 7:52pm