Reputation: 2045
This seems like it should be simple enough. I have a report that has Tablix in it that has groups by Customer forces a page break between groups. I want the page numbers to be per customer, so the pages would be like so:
Customer1 Page 1/2
Customer1 Page 2/2
Customer2 Page 1/1
Customer3 Page 1/4
etc, etc
I can't seem to find a way to reset the page numbers or cause the total pages to be total pages for the group.
Upvotes: 2
Views: 5827
Reputation: 1
Open RDLC report
Upvotes: 0
Reputation: 1281
It can be done actually, but not without adding some custom code to the report:
Shared reportGroup as String
Shared newPage as Integer
Public Function ResetPageNumber(newGroup as String)
If Not (reportGroup = newGroup)
reportGroup = newGroup
newPage = 1
Else
newPage = newPage + 1
End If
Return newPage
End Function
Then in the footer, add text box for page number and make it's value:
= Code.ResetPageNumber(ReportItems!TextBoxWithYourGroupNameOrID.Value)
Upvotes: 1
Reputation: 2045
It looks like this can't be done, at least in VS 2012. I was able to get it working in an RDL for SSRS, then I opened that RDL and found the relevant section
<Group Name="MemberId">
<GroupExpressions>
<GroupExpression>=Fields!MemberId.Value</GroupExpression>
</GroupExpressions>
<PageBreak>
<BreakLocation>StartAndEnd</BreakLocation>
<ResetPageNumber>true</ResetPageNumber>
</PageBreak>
</Group>
I then brought that back to my RDLC and inserted the <ResetPageNumber>true</ResetPageNumber>
into my group. When I opened the file again in VS showed the following error.
Deserialization failed: The element 'PageBreak' in namespace
'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition'
has invalid child element 'ResetPageNumber' in namespace
'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition'.
List of possible elements expected: 'BreakLocation' in namespace
'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition'
as well as any element in namespace '##other'. Line 1812, position 20.
End result, I'm moving the report to Reporting Services.
Upvotes: 4