- Computers & Software
SSRS Hide Empty Rows based on a condition
Tablix in SSRS
One of the behaviors of the tablix on the SSRS is that it automatically sizes the tablix (Table) to fit the data contained in it. Have you ever created a report wherein you have to print the data on a template paper (Logos, label, etc) are already printed on the paper, wherein the exact position of the data to write to is constant/fixed.
Below I will show you one work around for this problem. So lets get started.
Here's what we are trying to solve
So were trying to display the records in 4 records per page, but since the records outputted has a variable count, this is that happens :
(Note: Paging should already be in place for this report)
1. We'll start by designing the table to have the header, labels and other objects on the SSRS Report on their respective location.
2. By this time, we're expecting that the table design includes: 1st row are headers, 2nd row are data values.
3. Now, "Right click" at the 2nd row and select "Insert Row -> Outside Group Below", this will add additional row below the data row, do this until you reach the required rows per page (in our case 4).
4. "Right Click" on the 1st empty row, then select 'Row Visibility"
5. On the "Row Visibility" window, select the "Show or hide based on an expression" and set the following expression:
Empty Row 1 : =IIF(CountRows() < 1 = 0, true, false) Empty Row 2 : =IIF(CountRows() < 2 = 0, true, false)
Empty Row 3 : =IIF(CountRows() < 3 = 0, true, false) Empty Row 4 : =IIF(CountRows() < 4 = 0, true, false)
These will show or hide the empty rows, depending on the record content of the page, giving the page a constant displayed rows of 4.
Images based on the above solution (Flow)
What the solution provides is that we fill up the gap to reposition the items after the tablix. So that's about it, that should solve the problem.