SSRS 2008 Removing white space when hiding elements - reporting-services

I have been trying to resolve this simple issue for a few hours with no joy.
I have two tables within my SSRS 2008 report which are bound to different datasets and I need to show or hide the appropriate table based on a passed in parameter. This I have done with the hidden property of the table which works as expected. The problem I have is that when hiding the top item and showing the item beneath it I get the white space from the hidden item.
Trivial example
I created two tables and bound them to the same datasource laying them vertically.
I then set the hidden property of the top table to true and previewed the report.
You can see that the first grid is hidden but the white space remains. From my investigations I did see the ConsumeContainerWhitespace property used for this but in my case it did not clear up the white space.
Question
Is there a method of removing the white space for these hidden elements?

I would recommend two solutions depending on whether the datasets are the same.
1: If they share a common dataset then I would nestle them in another table that has 1 column, and 2 rows, and then change the row visibility depending on the parameters.
2: If the datasets are different, I would make each table a sub-report and then change the visibility that way.
Just another workaround caused by SSRS quirks!

This can be fixed by ensuring that the reports ConsumeContainerWhiteSpace property is set to true.
This can be found in the report properties. Click the yellow surround for the report, press F4 to open the Properties pane, and you can find ConsumeContainerWhiteSpace under there.
See also ConsumeContainerWhitespace property to remove blank space in SSRS 2008 report

The behavior can be controlled by following method
1) Right click on the top left box on the tablix and click on 'Tablix Properties' to open the properties for the tablix
2) Click on the "Visibilty" tab on the left hand side of the wizard
3) Click on the "Show or hide based on an expression", click on the Fx and paste the following formula
=IIF(RowNumber("DatasetName")=0,TRUE,FALSE)
4) Make sure to replace the "DatasetName" with the your dataset name (the one that is related to the tablix)
5) Also make sure that the ConsumeContainerWhiteSpace property is set to "True"
ConsumeContainerWhiteSpace property is a report level property and can be changed from properties window for the report. (click on the report outside of the design area)
This worked for me very well.

Select the object, go to properties and set the size to 0,0

Wired. Only contained them in another tablix or subreport then it works in hide them with no white space.

Related

Slide Up Visible Sub Reports in SSRS Report

I have an SSRS Report composed off datasets (tablixes) and subreports. How do I have the reports slide up when they are visible.
Report
A (NOT visible)
B (visible)
C (NOT visible)
D (NOT visible)
E (visible)
Visibility is set based on user input/parameters, etc. In the above example what will appear on screen is the tablix B / sub-report E. How I want it to appear is with out extra white space which it now has.
or in another scenario they could just pick E which is common and now we get a lot of white space at the top. What setting do I pick, what code can i write to have the visible rectangle of data slide up to the very top of available space.
So all we see is
Report
B
E
or
Report
E
When you've placed subreports on your page, did you make whitespaces between them? I belive you did. And now, when you hide one of subreport, whitespaces still visible and accumulate. You should reorganize your page by insert rectangles one below the other without (or minimum) whitespaces between of them. Put your subreports into each rectangle and add whitespaces inside it. Change expressions to control rectangles visibility instead subreports.
Don't forget: in spite of subreport is hidden, it is still retriving data and loads your server. To avoid it, pass visibility status to your subreports, to tell thems datasets to select null.
P.S. If you see extra white space in preview mode, it is not allways the same as browser will display. Especially if you hide object directly, without using expression.

How would you dynamically hide or display a SSRS header based on a parameter?

I need to hide or display the header of a SSRS report based on the value of a parameter. The parameter is called "Show Header?", and the values of this parameter are true and false. Is there a hide property for headers? If so, I'm not able to find it.
I'm not sure if you are talking about the table Headers or the report header (some people seem to use the term interchangeably).
I'm still self learning SSRS so there may be better options out there but a quick test i found the following.
For a Boolean Parameter type:
I used the logic below to hide the visibility based on parameter (you may want to play around with the true/false order depending on your parameter to get it to work how you want):
=IIF(Parameters!ShowHeader.Value, False,True)
Table Headers:
Just highlight the text boxes you want to show/hide and open up the properties, under Visibility select "Show or Hide Based on Expression"
(NB. i found highlighting the full row would only let you select the full tablix properties not the single row so I just shift clicked all the cells and pasted the IIF statement into the "Hidden" Property for the selection in the properties window)
Report Headers:
I am not sure you can hide the Header (couldn't see any immediate hiding properties or options), however you could hide the contents of the header using the same sort of process (right click properties and alter the Visibility setting or add the code into the Hidden property). In testing I found that the header would reduce to remove white space when items where hidden so may work out for you.
The sneaky way I've found to get around the limitation of SSRS on this is to put my "header" in the first row of the first tablix and just hiding the actual report header, which you probably know cannot be deleted. That way, I can show or hide the first row of the tablix by whatever criteria I desire. This method works well for me.

Empty page when hiding tablix

I've got a number of tablixes and they hide/show expressions.
If we run the report for a particular dataset, the first tablix is shown on the first page and the data ends pretty much on the last line of the page.
The second tablix is hidden in this particular scenario but since I have left about 1cm gap between tablixes, this causes a new empty page to be created. Is there any way of removing this gap?
Move the tablix's closer together (basically remove as much whitespace as you can)
If you need more space when you are showing the tablix - add a row to the top of the tablix and set its visibility to false.
This is often caused by the feature of ssrs preserving whitespace around objects that are hidden
Check for the page breaks in the tablix properties. It may be there which is causing this.

SSRS giving a blank page at the end of report [duplicate]

This question already has answers here:
How to get rid of blank pages in PDF exported from SSRS
(16 answers)
Closed 5 years ago.
I am getting a blank page, at the end of my report in SSRS 2005.
I have a header logo and footer date values, and I have set the both to PrintOnLastPage = False, but I am still getting a blank last page.
Any ideas how to eliminate it? Thanks!
This solution applies for SSRS 2008 R2. I am not sure about earlier versions.
On Report Properties page, under category Other, set ConsumeContainerWhitespace to True.
Other suggestions still apply: Make sure your Paper Size can contain Report Width and Margins. Remove any white space you may have on your Report.
Good luck.
Shorten the width of the report, dragging the right vertical side to the left.
Setting ConsumeContainerWhitespace works, but may cause a catastrophic increase in report generation time, especially for very large reports.
An alternative solution is as follows and involves keeping track for yourself which record is the last record in your dataset.
SQL - Track Row Number vs. Total Rows
You may use a technique such as the above to track Current Row # vs. Total Rows, just make sure that your "Order By" mechanism matches that of your main select statement.
Add an end-of-record page-break to all but the last record
Add a vertically-tiny rectangle to the end of your report body
Rectangle Properties -> PageBreak -> BreakLocation -> End
Now, we want this rectangle to be visible when we desire a page break, and we want it to be hidden when we do not want a page break.
Thus, in the Rectanble Properties (right click) -> Visibility -> Show or hide based on an expression -> Expression Edit
=Fields!RowNumber.Value=Fields!TotalRows.Value
This will cause a page break to occur at the end of each record, except for the last record
I had a report that kept printing a second page.
Someone else had added the tablix and set a "Page Break" END property to the tablix.
When I changed this to NONE it solved the problem.
I had a report containing a subReport. The subreport had a 'PageBreak' property with the 'BreakLocation' set to 'Start'. Changing it back to 'None' removed the blank page I was getting.
Adding to what MikeGee had answered and considering this is a very old thread, I thought I would add my 2 cents.
To avoid blank pages, set each "BreakLocation" property of each tablix to "None". Sometimes it defaults to "End" and the number of blank pages depend on the number of tablix in your report.
For example if you have 3 tablix in your report and if each tablix has a "BreakLocation" property set to "End", you will have 3 blank pages.
set ConsumeContainerWhitespace to True if it is 2008 R2.
I had an image on the last page and when it's size was set to 210mm, 297mm (A4) it produced a blank page at the end of the report. But when I changed the height size from 297mm to 296.9mm the blank page disappeared. This was using VS2013.
Check your margins as explained above
+
If you have a tablix that dynamically adds columns to your report, check that the "runtime width" of you tablix is within your margins. At runtime, it may be larger than the body-width you specify in the designer.
(Note: it's impossible to do this with the designer; try reducing the size of your columns to see if the blank page disappear).

Get rid of page breaks in report

How do I get rid of the page breaks in an SSRS report, making the report display in a single page?
Open the report's .rdl file in a text editor and locate the <Page></Page> section.
In that section, insert the following:
<InteractiveHeight>0in</InteractiveHeight>
<InteractiveWidth>8.5in</InteractiveWidth>
In SSRS, an interactive height of 0 means the report has an infinite length and therefore, it will exist on a single page.
Make sure you do not have one of the properties set to true on one of your report items for PageBreakAtEnd or PageBreakAtStart. Also, make sure you keep the width of your report less than the width of your actual paper, keeping in mind extra space for the page margins (Report > Report Properties > Layout)
And according to Microsoft:
"Although it is not recommended, you can disable soft page breaks by setting InteractiveHeight to 0." I think this only works for HTML rendering though, I have not used it myself.
I'm not sure if there is a scale of any kind where no matter how big your report is it still prints on one page if that is what you are looking for.
Right Click anywhere in Body and select Properties.
select Reports From the DropDown. (When you select an element in report, the dropdown changes to TextBox/Header or the item you select)
In Report properties, Expand InteractiveSize Attribute.
Set Height -> 0in
If you're trying to display report data in one page, it is simple to do in SSRS. All you have to do is select an entire table and then go to the property pane. Update KeepTogather = True.
You can set the report's InteractiveHeight to 0 to disable paging.
Go to report properties -> Page -> InteractiveSize -> Height. Set this value to 0in.
Here is the similar question.
Dustin Brooks wrote:
Also, make sure you keep the width of your report less than the width of your actual paper, keeping in mind extra space for the page margins (Report > Report Properties > Layout)
Also be extra careful about this when working with subreports. I've lost count of the times I ended up with extra blank pages when I've accidently made a subreport wider than the main report.
When creating reports for the web, I would disable page breaks by setting the InteractiveSize to something really crazy, like 1000x1000". (I just checked, and setting it to 0x0" as Dustin Brooks mentioned in his answer has the same effect.)
I left the PageSize property at 8.5x11" and the reports printed across multiple pages normally.