views:

4867

answers:

4

Is there a way to set a table's visibility to false, if the table has no rows?

I want to hide a table in Reporting Services when it has no rows.

Setting NoRows to ="" isn't sufficient in this case as space is still left for the table, and some of the table's formatting is still visible.

I'm using Microsoft Visual Studio / SQL Reporting Services 2005

+5  A: 

Try setting the table's "Visibility.Hidden" property to this expression:

=CountRows() = 0
Matt Hamilton
Thanks :) That's nice and concise too
Sophia
Should it be =CountRow() == 0
Chris KL
No, Reporting Service's internal expression language is VB, which just uses a single = for comparison (as well as assignment).
Matt Hamilton
My expression always seemed to do the opposite of what I expected. No wonder, the expression is setting "Visibility.Hidden" as opposed to "Initial visibility" as the dialog implies. Grrrrr!
Even Mien
+1  A: 

Found the answer on my own, it's pretty simple.

I found this article which mentions the CountRows() function.

So to set the Visibilty / Hidden property to hide when there are no rows, it's simply

= Iif (CountRows() > 0, false, true)
Sophia
A: 

I need to carry this one level further. I have a report with a subreport that I would like to suppress when there are no subreport records.

I have added the "= Iif (CountRows() > 0, false, true)" in the subreport textbox, the subreport detail handle, the main report subreport box, and the main report subreport line handle.

However the blank line is still there if there are no subreport records returned.

Any ideas?

TIA!

A: 

Yaa , i have same type of problem that Rik describe. Any one please help.

sahil kaundal