How To Restar The Page Count Reporting Services
Today I desire to tell you how to fix page number for every group in MS Reporting services. The approach differs depend on what version of reporting services yous utilise.
If y'all use MS Reporting services 2008 R2 then you tin can use commencement approach with ease. But if yous utilize free MS Reporting services redistributable package use second approach.
First arroyo:
If you lot utilize MS Reporting services in your project information technology's not a trouble to set new folio number for every group.
You tin take a look at this mail service how to accomplish it
In brusque, just to ready PageBreak -> ResetPageNumber holding to true and this works in MS Reporting services 2008 R2.
Second approach:
But in my project I used MS Report viewer redistibutable 2008 and this version doesn't take such holding.
Then to set up the page number for every group from the beginning I use the following algorithm.
1. Add together the textbox to the folio with the group field value. Merely to say, field by what yous group your study.
Set the Name property for it, for instance GroupValue. If you don't want this field shold be visible just set up it's visibility to faux in textbox properties.
ii. Get to the report properties fild Code value and add some code.
For adding code to the page simply choose "Report" menu.
Then "Report Properties" and finally "Code" tab.
The thought of algorithm is to set the page number once, save it'southward number to array and when we flip pages back, non to count information technology from showtime, but take folio number from global pages array.
This idea works perfectly and hither some code how to set this solution up.
Pages array which we create when the report loads, the array has the number of elements the same as full number of pages.
And if elements in pages array is less and then total number of pages (we can take it from global variables)
we add the page number to assortment. So, when we'll add together all report pages to assortment, next time nosotros tin have the desired folio number from this array.
Information technology'll exist easier to figure it out when you have a look at this code:
Shared showtime as Integer
Shared currentgroup equally Object
Shared currentPage as Integer
Shared Dim pagesArray() Equally Integer
Public Part GetGroupPageNumber(group as Object, pagenumber every bit Integer, totalpages every bit Integer) as Object
If Not (group = currentgroup)
offset = pagenumber - one
currentgroup = group
End If
If (pagesArray Is Nothing) Then
ReDim Preserve pagesArray(totalpages)
End If
If (CountNumberOfElementsInArray(pagesArray) < totalpages)
pagesArray(pagenumber - 1) = pagenumber - offset
Finish If
Return pagesArray(pagenumber - i)
End Function
Public Function CountNumberOfElementsInArray(array() As Integer) every bit Integer
Dim counter equally Integer
Dim i Every bit Integer
counter = 0
For i = 0 To array.Length - 1
If (array(i) <> 0)
counter = counter + 1
End If
Next i
Return counter
End Function
3. And the tertiary step is to invoke the function from the study'due south page.
Just add the textbox to the header of the page where y'all want to come across page number and add side by side function call.
This calls the office written earlier.
Hope yous'll find something useful for yous in my mail!
How To Restar The Page Count Reporting Services,
Source: https://alexkuznetsov.wordpress.com/2013/05/06/reset-page-number-in-ms-reporting-services/
Posted by: leonmoneverel.blogspot.com
0 Response to "How To Restar The Page Count Reporting Services"
Post a Comment