SSRS page break after row with subreport (in recta

2019-07-06 10:58发布

问题:

I've spend hours searching for a solution for something 'simple'. I have a report (SSRS 2008 R2) with a tablix with rows grouped on saleslineid. For each salesline I want to show a sub-report with specs and after that the components of the salesline. But I want the list of components to start on a new page.

For instance:

SPECS:

Object A

Color Brown

Height 200

-- PAGE BREAK! --

LIST OF COMPONENTS

Item Description

100 COMP1

101 COMP2

etc

As you can see in the picture I've put my subreport in a rectangle and set PageBreak - Breaklocation to End.

Tried it with an inbetween row with a rectangle too. Read about 100 pages with more or less similar issues but I can't get it to work?

Can this be done?

Kind regards,

Mike

回答1:

It can be done but to clarify is this your layout? In your subreport should it look like this?

  • Specs
  • Components (this is on another page)

If yes then you enclose the whole specs in a rectangle then define a PageBreak -> BreakLocation on the End
Or
Enclose the whole Components in a rectangle then define a PageBreak -> BreakLocation on the Start



回答2:

I didn't find a way to solve it with a rectangle triggering a page-break so I decided to add one extra field linetype and one extra record to my query with a UNION.

E.g:

Select 1 as linetype, A.SalesId, B.SalesName
UNION
Select 0 as linetype, A.SalesId, NULL as SalesName

In the UNION query I skip fields I don't really need in that section to keep things readable.

With this new group I can force a new page and I hide rows in my tablix based on linetype

The thing I dislike is that my already hard to read sql query is doubled in size but it does the job..



回答3:

I have fixed the problem which is: page breaking is ok on local testing, but don't work on reporting server.

My report structure:

- Tablix
-- Rectangle (page break here)
--- Sub-report1 with visibility expressions
--- Sub-report1 with visibility expressions

Then I've tried to change the structure:

- Tablix
-- Rectangle (page break here)
--- Rectangle1 (another rectangle level)
---- Sub-report1 with visibility expressions
--- Rectangle2 (another rectangle level)
---- Sub-report2 with visibility expressions

And it's fixed both downloading url and viewer.

I hope can help someone who is struggling with this.