Using SSRS 2013. I am able to hide columns with boolean values, but the report (body) width does not shrink when columns are hidden. Thus, there is excess blank/white space to the right of the report. Is it possible to eliminate this excess space? If yes, kindly will you please advise how?
The report body width - as with any column width and unlike heights - is a set value that cannot be changed on execution. You need to either put up with the white space, format your presentation layer to not be affected by the appearance of the white space or redesign your report so the objective of hiding the columns can be achieved in a different way.
I ran into this exact same limitation of SSRS. I was able to achieve what I believe you are trying to get (consistent report and report col width when certain columns are hidden due to parameter vals, etc.)- by simply having 2, separately formatted report tablix/tables in the report and hiding/showing based on a parameter (or some SSRS-expressible logic):
1 for the condition when all columns are present; 1 for the condition when some columns are omitted- both of them formatted to utilize all available screen real estate to minimize white space and make things look "clean".
Instead of hiding column(s) when my hidden condition is true- I simply show the 2nd tablix and hide the 1st. And when the filter changes to show all columns, I do the reverse (hide the 2nd tablix and make the 1st visible again).
Not sure if that helps, but I figured I should share if it might aid anybody else facing this issue.
PS: Your tablix Hidden expressions will look something like this:
[the full column tablix].Hidden
=iif(Parameters!parmOmitSomeCols.Value = true, false, true)
[the tablix with some columns omitted].Hidden
=iif(Parameters!parmOmitSomeCols.Value = false, true, false)
Related
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.
Hi everyone,
I wanted to adjust the width of a tablix column dynamically. can some one please let me know how can this be done? when i searched some forums there was a suggestion that i try creating an instance of the report in the CODE of the report properties and access the tablix column using the instance but i wasn't able to do that. Can some one please help if indeed i can try creating an instance of the report and access the tablix and adjust the width dynamically ?
Thanks,
AJ
On the off-chance that anybody is still looking for a way to have dynamic column widths in SSRS (as I was), I've found way that works for most scenarios.
Basically you add another column header to your table/matrix/tablix and set your column to your minimum required width, then add a subreport to the new header. The subreport consists of a matrix with a static row group and a dynamic column group that generates a number of fixed-size columns based on the desired width, which is passed via a parameter from the main report to the subreport.
e.g. Your main report has a column where you want to set the width from data or a parameter, which is in a range from 5 to 10cm, with increments of 1cm. Let's say for a particular column you pass down 7cm to the subreport, which then does a basic SQL loop to produce some data with 7 rows. The matrix column grouping in the subreport points to that data, which produces 7 columns, each 1cm, for a total width of 7cm (plus the row grouping which is shrunk as much as possible). The main report's column then expands to the size of the subreport, which is 7cm.
Select the first column, in properties, find the width property (under size) add an expression that uses the same condition for hiding column 3 and increasing the width of the first column, e.g.
=iif(parameters!par.value=true,"1,5cm","2,5cm")
--EDITED --
I'm very sorry my previous solution was false, I hadn't checked it, I'm sorry to have wasted your time, but I have a solution that works.
create two first columns, i.e. two columns that show the same information, one that is the width that you like when column 3 is visible (lets call that one col1a) and one that is the width that is suitable to when column 3 is hidden (col1b) and then make those two alternate. then when you hide column 3 then you also hide col1a and make col1b visible and then the other way around
There is no property to auto size the column width. Length we can do it dynamically. That is the limitation Microsoft tools.
For now, one solution is to have a reasonable fixed column width (such, as 30) and set the textbox CanGrow to True so it wraps to next line if needed. Another solution is to have two columns and hide one of them conditionally.
Help me please.
A Tablix has 7 rows but I need to increase height of tablix until it matches the footer.
What should I do?
[Edited.]
According to below figure, I tried to insert a lot of blank rows to a Tablix.
And I used an Expression for setting visibility each row.
Example :
-If Dataset has one record. One Blank row will hide.
-If Dataset has two records. Two Blank rows will hide.
But It is inflexible because some rows aren't a single Line.
Using RDLC 2005 you can simulate this behaviour with:
a Body section with Body.Height = Page.Height - Footer.Height - TopMargin - BottomMargin
a Tablix without border
a Rectangle for every column to simulate with Rectangle.Height = Body.Height; set its RepeatWith property to Tablix
In order to simplify some operations you could put your Total textbox in the Footer or consider it when you build your Body section as explained before.
There is an example of what I mean (Tablix with red border and Rectangle with black border):
Another, though more complicated way, of forcing the height would be to use Subreports for each of the columns.
Each Subreport would list the table contents for that column as a single list.
You could then force height of a single table row to reach the footer... If the Subreport does not require the entire space it will return whitespace
Parent Report
Report 5
Report 4
Results in the following output report
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.
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).