Domanda

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.

È stato utile?

Soluzione

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.

Altri suggerimenti

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)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top