I am using SSRS report (VS 2010) and 'tablix' object.
I need showing the tablix only once in the report (it is used only once for the first page, or for the last page, or whenever I like to).
(I have thought to add a variable, and set it while doing the report (like a flag), and check that flag, but I don't know how doing that, and whether there is better way).
How can I show the tablix only once?
Thanks :)
As the link: https://msdn.microsoft.com/en-us/library/dd220592.aspx, table is a preffered way to create some 'fixed' elements in SSRS.
You can use header for fixed elements and body for the variables length.
Nevertheless in the body you can declare a subquery and do any design desired.
Related
I'm facing an odd issue: I'm going to create lots of reports using reporting services (SSRS) and one request was to create a subreport that will be shown as a header in main report. I've come across two main problems:
It is not possible to insert subreports into report headers. I thought of a possible workaround and just create a subreport without header and then insert subreport on top of body in main report. But then I faced another problem:
My header contains a logo, title and page number. However, function for page numbering cannot be used in report body, only in header.
Is there any alternative? Or should i just add a header to each report instead of trying to create a subreport for the header?
You can start by using a report with the header as a template. You would start with this whenever you make a new report. That at least eliminates the need to recreate it each time.
If you do want to be able to manage the headers dynamically, you can use a data-driven approach. Almost all of the properties for images and text boxes can be defined with expressions. And the expressions can refer to a dataset. In other words, you can store all of your preferences in a table. Your header template would include a dataset that brings in all the settings. Then you can use expressions to define how the header will look.
By doing this, you would be able to adjust the image, font size, etc. in all the headers at once just by changing a value in your table. Obviously there is some overhead with setting up the template this way, but it has a negligible performance impact and gives you more power to manage the header dynamically.
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
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.
I've always hated working with SSRS and I'm currently pulling my hair out over page breaks.
My report has a table with products which are grouped by a purchase. I want all purchases' product tables to appear on a single page, instead of one page for each unique grouping value.
Whenever I Google how to disable paging everyone points to this thread which I have followed - both interative height and width are at 0.
Starting at my table (wtf is a 'tablix'?) I have checked the PageBreak property of every container and all are set to 'None'.
The ONLY way I have so far managed to disable paging is to edit the report's XML and replace every instance of <BreakLocation>Between</BreakLocation> with <BreakLocation>None</BreakLocation>. According to this MSDN article None is a valid value, but after this change Business Intelligence Developer Studio can no longer display the report, complaining "Deserialization failed: Requested value 'None' was not found". **Slow clap for BIDS.
My three specific questions are:
Why can't I see the BreakLocation property anywhere in the report designer?
Why is BreakLocation being set to 'Between' when everywhere possible I have set PageBreak to None?
Is there any other way I can achieve what I desire that doesn't require editing the XML before and after using the designer?
I am using Business Intelligence Developer Studio 2008 and rendering reports in HTML.
Any suggestions much appreciated.
You can do this in your XML by finding your <Page> tag and adding
<InteractiveHeight>0in</InteractiveHeight>
in the beginning (or replacing the existing one).
(A tablix is a combination of a table and a matrix, it's what 2008 does with your reports. Easier to see if you use Report Builder 2.0)
You say you checked the page break location on every "container", but Tablix groups can also have their own page breaks. You'll need to check those too and make sure they are set to None.
I can't speak for why BIDS isn't allowing you to specify None as a BreakLocation. None certainly is a valid value as far as RDL is concerned.
With InteractiveHeight set to 0 and certainty that there are no BreakLocation tags in your report set to anything other than None, there really shouldn't be any pagination.
I had the same problem. Ath first I used the xml to find the tablix or tablix group which contained the page break. Later I found out that it could be solved by removing the PageBreak section entirely from the xml.
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.