SSRS - Page Break - Subreport - reporting-services

I have a report with two subreports inside. The main report has keeptogether true and page break checked in a group. Both subreports has keeptogether false and no page break.
My environment is SSRS 2008 and VS 2013 (Reportviewer 11)
I got two (separate) issues:
the page break is not working when I display the reports in reportviewer in browser. But it works when I export it into pdf.
if the main+subreports cannot fit to one page. then it basically cut the main report and subreport into different page (even though
keeptogether in mainreport is true and subreport is false)
Is there someone that can suggest what is going on? Some post stated that this is a default behaviour, if yes, is there any workaround for this?
Thanks before!

The default DisplayMode of the ReportViewer is set on Normal, try changing this to PrintLayout.
myReportViewer.SetDisplayMode(DisplayMode.PrintLayout);
When the report content exceeds the maximum page size it will break to a new page, there is no way of stopping this, in the designer the property even says "Keep together on one page if possible".
As your description of your actual report isn't completely clear, I'll assume that your main report has some data above the two subreports that you wish to be kept together.
To achieve this wrap that data inside a new Rectangle and set the KeepTogether property on True.
If I misunderstood you in anyway, just let me know and i'll update my answer.

Related

SSRS 2016 - multiple tablix on one report causes overlap when rendering

I have inherited an SSRS report which had an existing tablix on it - I want to add a further tablix below to display data from another data set as the format is very slightly different - each tablix displays a different kind of sales for a certain customer.
I have added the second tablix and the report seems fine within the report designer renderer, but when I access it via MS Edge directly from the URL the first tablix overlaps the second and obscures it from view.
I have set a page break at the end of the first tablix, and at the start of the second, and again in the designer renderer it works fine and pages, but in MS Edge it overlaps across the page break. In Chrome it renders OK.
The issue I have is I am displaying this SSRS report in a Web Browser Control on an access for an it renders just like it does in MS Edge so it looks screwed up.
It is like the first tablix just runs over into page 2 rather than making the extra content of itself page 2, and the second tablix then on page 3. I don't even really need the pages as ideally it would all be one long report with a vertical scroll, but this overlap issue means I have been trying to force it to split.
Any other way I can stop the first tablix obliterating the second one?
I had a similar problem recently (I found your question while searching for an answer). I didn't want to go to all the trouble of creating a sub report and eventually tracked down the cause of the issue for my case which may be the same as what you were experiencing.
The issue was that my first Tablix was setup with a height of 2.7cm. My second one's top was 2.66781cm. That caused both of them to overlap with each other when the report was rendered. When I changed the top of the second Tablix to 2.7cm the issue was resolved.

ssrs subreport page break not working

The ssrs subreport page break is not working.
How can I get ssrs sub report page break ? Thanks.
i.e. Reports -> properties -> pagebreak is not working.
I usually put a subreport in a Rectangle and let the rectangle control the page break.
I'm not sure where you want to put your page break. Judging by your picture and arrow, it seems you're concerned with keeping the data of one subreport together without breaking.
This would be the KeepTogether property of the subreport object. Set it to TRUE so it will add a page break rather than break up a subreport instance.

Referring to ReportItem properties in SSRS

In an SSRS report expression, is there any way to refer to the "Hidden" property of a ReportItem?
More specifically: my SSRS report consists of a summary, with a subreport containing detail. I'd like to be able to stop the subreport running if it's hidden, as in this question. The answer to that question recommends changing the query based on a parameter, but my problem is how to set that parameter. Actually, I only need the parameter to be 1 or 0; the query will just return nothing if it's 0, and that's good enough.
I'd like to be able to show or hide the subreport using a textbox as a ToggleItem, and have an expression as the parameter value that goes something like this:
=iif(ReportItems!SubReport1.Hidden=False, 1, 0)
...or this:
=iif(ReportItems("SubReport1").Hidden=0, 1, 0)
...but the "Hidden" property doesn't appear for either.
Other options I've explored:
Putting in an invisible text box, and using its value in the parameter expression as per this MSDN article. The problem then becomes how to set the value of the text box.
Using a variable; same problem applies (actually I'm not even sure how you use variable in SSRS, or even if you can).
Keeping the subreport as a separate report, and linking to it; a bit inelegant, and means losing the other report content when the user wants to see the detail.
Extensive Googling; returns a lot of ways to set the "hidden" property, but no way to reference it.
Suggestions, moral support, constructive criticism and barefisted abuse all gratefully received.
As the answer here stated, you can't stop a hidden item from running. If you don't want the subreport to run when you render the main report, you'd need to run the main report with this variable that prevents it from running in the first place.
To this end, it would make sense to simple hide or show this subreport by using the parameter, rather than a textbox toggle. You can reference the parameter's value for this on the subreport by using:
Visibility -> 'Show or Hide Based on an Expression' -> f(x)
IIF(Parameters!ToggleSub.Value = 1, true, false)
The thing is, if you included a textbox to toggle the visibility at this point, the only way to do it would be to pass back a parameter and refresh the report anyway. Once you choose not to render the subreport, it will only render if the entire report is refreshed.
I hope this helps you out.
The question you linked above shows how to use a report parameter to control the visibility and execution of subreports. But that's different from using a report item such as a text box to do it.
It sounds like what you're really looking for is on-demand execution of subreports, which I'm afraid isn't possible. The report rendering only happens once when the report is first displayed unless you change parameters and run it again.
I'm afraid your only option for on-demand execution of the detail report is to use a "drill-through" design. That means text boxes on your report that serve as links to the detail report instead of the detail report being used as a subreport.
SSRS 2008 R2 Drill Down On-Demand to Sub Report

Report only prints first page on SSRS 2008, prints perfect in SSRS 2005

We have a report that prints perfectly for SSRS 2005, but will only print the first page when using SSRS 2008. We have seen issues like this before with other reports.
At the bottom of the report there is a section that has a "list" inside of a "list". Nothing fancy going on. The parent "list" groups on a value called "UnitId". The child "list" groups on a value called "Id" and has "UnitId" set as its parent group.
Some of the things I have already tried is to set the "keep together" property = true and it didn't work. I've also tried setting a couple different "page break" properties on both lists to no avail.
Anybody have any advice on what I should be doing or looking for?
We got the same issue, I've found this post on the MS Site - http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/4b1840c7-f48a-4a29-b802-5e2e8d04d5a6
I've not tried it yet, but sounds like the same issue.

Subreports try and keep together leaving blank spots/pages

Reporting Services 2005
My layout is like this:
I have the mainreport which contains a table
This table has 3 groups it runs by, GrpLevel1, GrpLevel2, GrpLevel3
Sub-Reports are added to one of 3 groups and are executed passing that group key to the sub-report
So, a particular sub-report will run at GrpLevel1 and for every level2 it contains, the sub-reports under GrpLevel2 will run.
The problems I'm having are that the sub-reports want to jump to the next page leaving a gapping hole of white-space in the report.
If a sub-report contains a table with a bunch of data and it can not fit on 3/4s of a page (first page on report has report header on top 1/4), it will jump the whole thing to the next page leaving only a header, rather than printing what it can on the first page.
On the table I have "Keep Together" turned off.
I'm at a loss and about ready to set my cube on fire. Insight in to this would be greatly appreciated.
UPDATE ****************THIS HAS BEEN FIXED IN SSRS 2008 R2***********************
It has been fixed with (SQL Server) Reporting Services 2008 R2. You can now toggle the KeepTogether on Sub-Reports. Pagination looks a lot better.
Looks like there is no solution to this problem. The bug is aknowleged by microsoft, but its still not fixed in SSRS2008.
From the KB article (http://support.microsoft.com/kb/938943)
This behavior occurs because the
Subreport control has an implicit
KeepTogether property. By design, the
KeepTogether property tries to keep
content of a subreport on one page.
Because of this behavior, the report
engine creates blank space on the main
report if the subreport does not fit
on the same page as the main report.
Then, the report engine creates the
subreport on a new page.
The work around that they list is essentially 'don't use subreports'
I am not sure about the earlier version of SSRS, but I faced this same issue in SSRS 2008.
The solution is to change the Subreport property in Code.
Go to the solution explorer, right click on your report and click on "View Code".
Search for your Subreport.
Inside subreport tag you'll find "<KeepTogether>", which would be set to "true", change it to "false"
This property is not avaiable from designer and has to be changed from the actual report xml code.
right click of subreport and chose format subreport, then uncheck keep object together
Another way I got around this was to place the subreport in the report header. Of course that is very dependent on the report content and elminates any of the usefulness of subsequent sections but it did solve my problem of having a huge chunk of whitespace on the first page.
It took me a week to solve this one! But I did find a solution and happy to share it with you.
I had the exact same problem. In my main report, there is a Table that has 3 groups and 2 different subreports in each group. And these subreports had matrices. I believe regardless of matrices, subreports being placed inside group/detail bands within a table caused alot of unnecessary blank pages to be printed before, in between and after the sections. It was a pain the neck and I was thinking of removing the subreports but then it defeats the whole purpose of the report.
So finally, what fixed it was instead of placing the subreport in DETAIL bands of the groups in the table, place them in the Footer of the groups. Now I know this may change/affect the format of the report and may not fit in with your report purposes. But this fixed the issue for me. Another way of getting around the blank page issue was leaving the subreports wherever they are (detail or group bands), and moving OTHER detail bands into one Footer band. Essentially what needs to be kept in mind, is to reduce the number of detail/group bands inside the table. Limit the groupings and have minimum number of subreports within a table if you can manage that.
Hope this helps someone out there.
For SSRS 2008
If your subreports are in any group, you should go to group properties and switch the keep together property for that group(s) to false. This worked for me.