Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Reporting Services Development
 Reset Page count or use distinct count() for pg #

Author  Topic 

bubberz
Constraint Violating Yak Guru

289 Posts

Posted - 2005-09-21 : 14:28:19
I have a report that will come back as 20 pages.

What the user wants is on the beginning of another unique ID, which causes a new page to be started, to have the page count restart at 1.

So, if I have 3 UniqueIDs for all 20 pages, and the first, IDAA, is 10 pages long, the second, IDBB, is 4 pages long, and the third, IDCC, is 6 pages long, then the page numbering would be as:
1-10 for IDAA
1-4 for IDBB
1-6 for IDCC

I know how to do this with Crystal, but am trying to figure it out here with either a page count formula, or some type of distinct count().

Thanks!

bubberz
Constraint Violating Yak Guru

289 Posts

Posted - 2005-09-22 : 14:03:22
This is what I've tried so far, but it resets on every page.
So, each page is 1 even if the Unique ID spans 2-3 pages.
I only need it to reset on a new field grouping of the list object.


Here's the VB code for the report:

Shared offset As Integer

Public Function GetPN(reset As Boolean, pagenumber As Integer) As Integer
If reset
offset = pagenumber - 1
End If
Return pagenumber - offset
End Function

***************************

In the header, I have a textbox named "tag"

In the footer, I've got the following expression:
="Unique ID Page: " & Code.GetPN(Not(ReportItems!tag.Value Is Nothing),Globals!PageNumber)
Go to Top of Page

bubberz
Constraint Violating Yak Guru

289 Posts

Posted - 2005-09-22 : 17:06:44
My fault...I had the textbox "tag" in the page header and not in the list object itself.

It works!

Thanks!
Go to Top of Page
   

- Advertisement -