SSRS 2005 -Set Visibility based on dataset rowcount
Asked Answered
M

3

17

I have a line and a table in my report that I want to hide if my dataset has no rows in it.

I tried using the expression =CountRows("MyDataSet") > 0 in the initial visibility but this always evaluates to false, even when there are rows in the dataset.

I suspect initial visibility is run before the data is loaded into the dataset.

How can I set the visibility of my table and other elements (a line), based on if the dataset has any rows or not?

Munshi answered 16/12, 2010 at 16:55 Comment(0)
F
30

This appears to work in 2008 - hopefully it will help ...

I created a DataSet with one record in it. I then created a text box and put your code in the 'Hidden' property in the Visibility Properties section.

I then changed it to

=CountRows("MyDataSet") < 1

Which will return TRUE when there are no rows, which will set the control to hidden.

Figured answered 16/12, 2010 at 22:44 Comment(0)
N
13

Use =IIF(CountRows("DataSet1") > 0, false, true) inside the expression of visibility property of the control.

Nichrome answered 26/7, 2011 at 12:9 Comment(0)
C
0

Worked totally

=IIF(CountRows("OpenItem_DS") < 1,"", "Wk No")
Cheerless answered 1/8, 2012 at 1:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.