Tablix header not repeating on new page, when subreport causes page break

早过忘川 提交于 2019-12-04 04:21:42

A very clean and simple way to repeat the column header on each page

http://www.a2zmenu.com/Blogs/BI/Tablix-headers-not-repeating-in-SSRS-2008.aspx

We've solved our problem... although not in the most ideal way.

The Page Header (of the "master" report, not the subreports) seems to be the only way to consistently have a header section.

We implemented a solution based in large part on this blog posting: Maintaining State in Reporting Services 2008

We modified slightly from the blog post, removing "id" from the methods and including a GUID to ensure the report values are not mixed up even if the user runs several copies of the report at the same time. (When using shared variables, remember that they are global to the report running across execution instances and across users on the report server, so a lot of care needs to be taken when they are used!)

In the report body we have a hidden text block that calls:

=Code.SetValue("xxx",Fields!Field1.Value) & Code.SetValue("yyy",Fields!Field2.Value)

and in the report page header we reference these as (for example):

=Code.GetValue("xxx")

This works because the body is calculated before the page header, even for Page 1.

Still, in the end it is a hack for something that should be in Microsoft's product, given that they have poured years of development into this product! Why we cannot have nested tablix's and easier to use headers is beyond me... again this is upgrading a report from a program from the early 90's which did all this without problem. At the very least, give us report variables that can be retrieved and set as the report is processed!

Regardless, things are as they are... we've tested the solution with shared variables and it seems to be working very well. We're going to run stress tests to make sure it's implemented correctly, I'll post something here if we find any further problems.

(And if anyone knows of some other way to get consistent header rows on pages, even when there are detail rows with large heights, please share...)

I have encountered the same problem as well. What I found was that the way to solve the issue was to de-normalise the data, adding a 'Record Type' field to identify whether the row was a parent or a child.

There were two sub-tables in my tablix, both displaying detail data linked to the outer grouping. If I set the headers of the sub-tables to repeat on every page (using the Advanced arrow > Static Properties > KeepTogether = True, KeepWithGroup = After, RepeatOnNewPage = True) then one of the sub-tables would display correctly, however the parent table's repeating header would just disappear.

To keep a long story short, this was a massively annoying problem to solve. The solution is simple, it worked for me, but may not work for everyone.

Linked below is a SSRS2008 example RDL that connects to localhost and has an example of the problem I had and also the solution I implemented. Please feel free to use it if you find it useful!

(I would've posted it on here but Stack Overflow fails for code blocks it seems)

http://www.sqlservercentral.com/Forums/Topic1111567-1633-1.aspx?Update=1

We have faced exactly the same problem during implementation of customer demands on SSRS Reports, And did try a lot of things which all of them resulted with failure.

In our case, Main Report has 4 subreport. Each SubReport should be started in new page. And also when new subreport begins, page header should be changed dynamically based on Subreport in body in current page.

Also one of SubReports which was SubReport3 has another case. Basically Main Report was running based on Dealer level. But Customer wants SubReport3 to run for each SubDealer related with @Dealer parameter. Also Customer wants to see each SubDealer data started in New page inside SubReport3.

As a result, we found different workaround as follows.

We created Page Header to Main Report. (Report Menu -> Add Page Header)(As @codinginthevoid said it is most consistent way)

We putted 4 subreports inside separate tablix. We added new column to each tablix. That column in each tablix visiblity = false, width of that column can be as small as possible, then created placeholder inside of that column, wroted down expression as follows:

If expression is in Tablix1, expression was ="Tablix1", if in Tablix2 then "Tablix2" and etc.

Then started design page header for Tablix1, each report item in pageheader that was putted for Tablix1 has visibility expression as follows:

=ReportItems!Tablix1_HiddenTextbox1.Value IS NOTHING

then applied same thing for Tablix2 and etc.

In the end, there were lots of textbox in PageHeader of report and some of them position was completely same, overlapped, But when reports is being rendered, each of those textboxes is being shown it is related page with related subreport.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!