SSRS - Add a page break after a specific group - SQL Server 2008 R2

牧云@^-^@ 提交于 2019-12-10 10:18:23

问题


Is there a way to add a page break after nth group?

I have a table that has two columns and is grouped by states.

State |  Name 

MA       Sarah 
         Bob
NY       Jane
TX       Klein

I want the 3rd group (TX), to be on it's own page. How do I add a page break after a specific group?


回答1:


Since you're using 2008R2, you can set up page breaks in a Tablix to be conditionally enabled/disabled based on an expression - in your case you'd only be enabling it where the State is TX. Here's an example based on your sample Dataset:

I've just created a simple table based on this:

Note that I've added a Report Header to display a page number. Looks as you'd expect without any page breaks applied:

Now, if you select the State group in the Designer and look at the properties, you'll note there is a Page Break section:

I've set the Disabled property to be:

=IIf(Fields!State.Value = "TX", False, True)

i.e. only apply the Page Break for the TX group.

Now we get one Page Break in the report as required:



来源:https://stackoverflow.com/questions/21435830/ssrs-add-a-page-break-after-a-specific-group-sql-server-2008-r2

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