In report design view, click the table, matrix, or list to display the row and column handles. Right-click the row handle, and then click Row Visibility. The Row Visibility dialog box opens. To set the visibility, follow steps 3 and 4 in the first procedure.
I tried the example that you have provided and the only difference is that you have True and False values switched as @bdparrish
had pointed out. Here is a working example of making an SSRS Texbox visible or hidden based on the number of rows present in a dataset. This example uses SSRS 2008 R2
.
Step-by-step process: SSRS 2008 R2
In this example, the report has a dataset named Items
and has textbox to show row counts. It also has another textbox which will be visible only if the dataset Items has rows.
Right-click on the textbox that should be visible/hidden based on an expression and select Text Box Properties...
. Refer screenshot #1.
On the Text Box Properties
dialog, click on Visibility
from the left section. Refer screenshot #2.
Select Show or hide based on an epxression
.
Click on the expression button fx
.
Enter the expression =IIf(CountRows("Items") = 0 , True, False)
. Note that this expression is to hide the Textbox (Hidden).
Click OK twice to close the dialogs.
Screenshot #3 shows data in the SQL Server table dbo.Items
, which is the source for the report data set Items
. The table contains 3 rows. Screenshot #4 shows the sample report execution against the data.
Screenshot #5 shows data in the SQL Server table dbo.Items
, which is the source for the report data set Items
. The table contains no data. Screenshot #6 shows the sample report execution against the data.
Hope that helps.
Screenshot #1:
Screenshot #2:
Screenshot #3:
Screenshot #4:
Screenshot #5:
Screenshot #6:
=IIf((CountRows("ScannerStatisticsData")=0),False,True)
Should be replaced with
=IIf((CountRows("ScannerStatisticsData")=0),True,False)
because the Visibility expression set up the Hidden value.
This didn't work
=IIf((CountRows("ScannerStatisticsData") = 0),False,True)
but this did and I can't really explain why
=IIf((CountRows("ScannerStatisticsData") < 1),False,True)
guess SSRS doesn't like equal comparisons as much as less than.
instead of this
=IIf((CountRows("ScannerStatisticsData")=0),False,True)
write only the expression when you want to hide
CountRows("ScannerStatisticsData")=0
or change the order of true and false places as below
=IIf((CountRows("ScannerStatisticsData")=0),True,False)
because the Visibility expression set up the Hidden value. that you can find above the text area as
" Set expression for: Hidden "
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With