Thursday, February 22, 2018

SSRS - dynamically hide and show subreports - WITHOUT them generating while hidden

Easy. Add a tablix to your report. Delete extra columns and rows so you have just one cell.. one row, one column. Put your subreport in the cell. Tablixes need data - but it doesn't have to be real data. If needed, you can create a dummy data source that just has something like "Select 1 as ID" Right click on the corner of your tablix and go to tablix properties, select the data source of your choice. Visibility will hide or show your tablix, which is needed. But your subreport will still hit the database and generate the visuals, and this is a massive performance killer. Go to the FILTER tab. Create a filter expression that returns false to prevent the report from generating and true when you want your report to generate.