How To Use Checkbox In SSRS

Introduction

In this article, I am going to share tips and techniques of using checkbox in SSRS. SSRS does not have a built in checkbox tool, so we are going to use checkbox by using some techniques and I will explain the techniques with a real time scenario.

Scenario

The client requirement is to create a SSRS report with the list of departments and check box for the departments and static section of the list of the sub reports,  which will drill through to respective sub reports.

Now, if a user wants to see sub reports for any one of the departments, it means that a user will select a checkbox against that department and then click on the sub reports,  which will drill through and show the records corresponding to the selected department.

Sample design for the report is shown below:



Here, are the steps to develop SSRS report, as shown in the design, above.

Step 1

Create one new SSRS report with one data source and one data set, named as Department with Script, given below:

  1. select('Department 1')as deptName  
  2. union  
  3. select('Department 2')as deptName  
  4. union  
  5. select('Department 3')as deptName  
  6. union  
  7. select('Department 4')as deptName  
  8. union  
  9. select('Department 5')as deptName  


Create one parameter with text as Data type, visibility property as hidden and default value as blank and name it as Dept.



Default value property will be given as blank.



Step 2

Create one Tableix with the two columns- one is for department field and another one is for the check box. Drag and drop deptname field from department's data set in to the Tablix's first column and give the below expression in the second column.
  1. =iif(Fields!deptName.Value=Parameters!Dept.Value,ChrW(&H2611),ChrW(&H2610))  


Note

ChrW(&H2611) for a filled-in checkbox and ChrW(&H2610) for an empty checkbox.

Go to font property, font style to Arial Unicode MS.



Remove border for the check box column, so we will get appearance like check box.



Step 3

Select checkbox column and right click -> Text box properties -> Select Action Properties, as shown below. Select “Go to report” action and then pick the same report name from the drop down, so when a user clicks the report, it comes to the same report.

Select Dept parameter from name drop down and set =Fields!deptName. Valuein value column.



Go to the Dept field, right click -> Text box properties -> Fill the given below expression in the fill color.
  1. =iif(Fields!deptName.Value=Parameters!Dept.Value,"PaleTurquoise","Transparent")  
We will get some nice effect when we click on the check box.



Step 4

Add one rectangle on the right side then add five textboxes inside the rectangle, as shown below:



Expression for title text.
  1. =iif(Parameters!Dept.Value<>"Blank",Parameters!Dept.Value &" - ","") &"Sub reports"  


Result



SSRS

 

Up Next
    Ebook Download
    View all
    Learn
    View all