Jaspreet Singh
Jaspreet Singh

Reputation: 319

SSRS Report Builder 2012 - How to hide list based on field value?

I'm using Report Builder 2012 to create a report. I have inserted multiple text boxes and other controls inside a list box so that I can hide all the controls at once just by hiding the list box. I'm using a SQL Server stored procedure to fetch rows of data. I'm using below expression to hide/show the list box.

=iif(Fields!certificateType.Value = "CT", False, True)

It works fine but it only checks the first row of data. If certificateType field is "CT" in the first row of data, it shows the list box but it doesn't hide the list box back for the next row of data in which certificateType is not "CT". It seems like list box visibility only checks the first row of data and applies it for all the other rows as well. How can i check the visibility of list for all the data rows?

Upvotes: 0

Views: 553

Answers (1)

R. Richards
R. Richards

Reputation: 25161

Okay, based on our chat I have updated this solution.

I mocked up some data that looks like this:

certificateType
---------------
AT
BT
CT
DT
ZT

I created a quick and dirty report with a list. In that, I added a rectangle with a textbox in it. I set the dataset for the list to the main dataset (DataSet1 in my case). I set the expression for the textbox to this:

=Fields!certificateType.Value

Image in design mode:

enter image description here

I clicked on the list, and in the Row Groups pane, I right-clicked the Details rows, and chose Group Properties. On the General section, I clicked Add to add a new group expression. Then I chose certificateType from the dropdown.

I moved to the Page Break section of the Group Properties dialog and ticked the Between each instance of a group check box. Click OK.

Now, the report will break for each instance of a certificate type that comes in the dataset. So, if you have ten different cert types in the data, you will get one page for each.

You can't see it in my image below, but there are 5 pages now.

enter image description here

Hope this helps!!

Upvotes: 0

Related Questions