Quantcast
Channel: SQL Server Reporting Services FAQ
Viewing all articles
Browse latest Browse all 158

SQL Server Reporting Services FAQ

$
0
0

Question 8: How to reset the page number back to 1 every time the report gets a group break?

 

 

Answer:

 

Resetting the page number on group breaks is not natively supported. There is a workaround: you can track group breaks in a shared variable, and reset this variable to 1 when reaches a new group break.

 

Here are the steps:

 

1.       Make sure there's a textbox in the report which contains the group expression.

2.       Add shared variables to track the current group and page offset:

 

Shared offset as Integer

Shared currentgroup as Object

 

3.       Add a custom function to set the shared variables and retrieve the group page number:

 

Public Function GetGroupPageNumber(group as Object, pagenumber as Integer) as Object

  If Not (group = currentgroup)

   offset = pagenumber - 1

   currentgroup = group

  End If

  Return pagenumber - offset

 End Function

 

4.       Use the function in the page header or footer:

 

=Code.GetGroupPageNumber(ReportItems!Category.Value,Globals!PageNumber)


Microsoft Online Community Support

Viewing all articles
Browse latest Browse all 158

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>