SSRS get rid of last page - reporting-services

I have a ssrs report with multiple rectangles.
Each rectangle has "add page break after" property checked. Each rectangle may or may not be visible based on certain conditions.
I want to get rid of the last blank page in the report.
I already set the ConsumeContainerWhitespace to true.
I can't think of another way to get each rectangle on different page and yet having no extra page.

Components that have the PageBreak property also have the Disabled sub-property. The result must be either True or False. When set to True, the page break will not occur. So what you would need to do is concatenate the other components' visibility conditions into one big condition in the Disabled property of the page break. Here's what it looks like in the RDL file (my example will always prevent the page break) :
<PageBreak>
<BreakLocation>End</BreakLocation>
<Disabled>=IIF(1=1, True, False)</Disabled>
</PageBreak>

Related

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.

Hide multiple rows or columns in SSRS report with same Expression at same time

I have a report containing a Tablix/table with sets of rows and columns which I am hiding conditionally using Expressions, via the Column/Row Visibility dialog.
If for example I have 3 columns which I want to all have the same Expression to determine their visibility, is there any way for me to achieve this without opening the Column Visibility dialog for each Column and entering the appropriate Expression?
I've tried selecting multiple columns, but then the right-click context menu no longer offers the Column Visibility option (it's greyed out) and I have also tried out the Hidden property of the columns (which can be amended in bulk by selecting multiple columns), but this only stops the columns from being rendered, leaving a blank space where they used to be (rather than how Column Visibility works, where columns to the right of the hidden columns are moved across to fill the gap, like hiding columns in an Excel sheet).
Is it possible to achieve what I'm after, or will I have to continue opening the Column/Row Visibility dialog for each column/row I wish to conditionally hide/show?
If the columns you want to control the visibility for are next to each other, you can create a Column Group for them and manage the visibility via the Group.
Add a new column group at the appropriate level so that only the relevant columns will be included.
If you already have Column Groups this will likely be a Child Group or an Adjacent Group.
If not, you can create an initial Column Group by dragging a Dataset field from the Report Data into the Groups pane.
Insert new columns inside the new group, and move the data from your existing relevant columns into the group.
The new group does not need to repeat, so in it's properties window set Group on: to a plain text value, e.g. "1".
Input the desired visibility settings into the Visibility page of the properties window.
For each of the individual columns inside the group set the Hidden property to False, to remove any other expressions or settings that might interfere.
Not exactly what you are looking for but perhaps a midway point - and this can apply to many things other than visibility (e.g. background colour, tooltip) - edit the RDL directly using View Code. This has the added benefit of being able to implement changes that are almost identical per column instead of identical with a minimum of mouse usage.
Typically I have set one column up the way I like it in the designer and then copy/paste under the other columns. In the case of visibility look for <TablixColumnHierarchy><TablixMemebers>. You will see a list of empty <TablixMember /> items along with the expanded <TablixMember><Visibility><Hidden>=... block where you have set up one column. Simply copy paste that block over the empty items at the position of interest (you will need to count it out unfortunately as there are no identifiers).
Bonus Tip: If you make a mistake or want to change something later, you can do a replace on all expressions at once (optional regex allowed).
Remember to backup or check in your work first because the designer may not open that report again correctly if you make a mistake :-)
Select the columns you want to conditionally hide and press F4 to see the Properties Window. Look for the Visibility node and use the Hidden property to set the conditionally expression.
The expression should evaluate to True for hiding and False for showing.
Let me know if this helps.

SSRS 2008 Removing white space when hiding elements

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.

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.