Pages

Men

rh

4/28/2012

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

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

The Steps to be follow:
  • Make sure there's a textbox in the report which contains the group expression.
  • Add shared variables to track the current group and page offset:
  • Shared offset as Integer
  • Shared currentgroup as Object
  • Add a custom function to set the shared variables and retrieve the group page number:
Public Function GetGroupPageNum(group as Object, pagenum as Integer) as Object
If Not (group = Currentgrp)
offset = pagenum - 1
Currentgrp= group
End If
Return pagenumber - offset
End Function

Use the function in the page header or footer:
=Code.GetGroupPageNumber(ReportItems!Category.Value,Globals!PageNumber)

No comments :

Post a Comment