Resetting page number when group changes in SSRS
Ajit
April 25th, 2011 2:34pm
Hi,
Please follow this link
http://blogs.msdn.com/b/robertbruckner/archive/2010/04/25/report-design-reset-page-number-on-group.aspx
HTH,
Ram
Free Windows Admin Tool Kit Click here and download it now
April 25th, 2011 2:39pm
Thanks Ram. We are not on SQL 2008 R2 yet.
Do you have any work arounds for SQL Reporting services 2008 ?
Thanks
AjitAjit
April 25th, 2011 4:40pm
Hi Ajit,
I think in 2008 its not directly possible. I had implemented this functionality in 2005 with the help of blogs. Please follow the link
http://blogs.msdn.com/b/chrishays/archive/2006/01/05/resetpagenumberongroup.aspx
HTH,
Ram
Free Windows Admin Tool Kit Click here and download it now
April 25th, 2011 9:58pm
Hi Ram,
I am trying that. But getting an #error instead of page number while running the report and my function while calling from the footer of the report with a text box is giving 'Unrecognized identifier'.
Attached is the custom code I have added.
Shared offset as Integer
Shared currentgroup as Object
Public Shared 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
Following is the expression I have for the text box.
="Page: " & Code.GetGroupPageNumber(ReportItems!Category.Value,Globals!PageNumber)
I am not sure what's wrong in what I am doing. But somehow it's not taking the function as valid.
Thanks
AjitAjit
April 26th, 2011 8:46am
Hi Ajit,
Based on the custom code you posted above, I can use it to reset the page number after add a page break on a group. Please be advised that in the expression =Code.GetGroupPageNumber(ReportItems!Category.Value,Globals!PageNumber), the argument ReportItems!Category.Value
refers one textbox which name is “Category” in the report. So, please change the Report Item name in the expression based on your environments. To check the Text Box name, please refer to the steps below:
1. In the design surface, click the Category field like this:
2. In the Properties window, check the text box name.
3. Set the textbox of page number to expression like this:
=Code.GetGroupPageNumber(ReportItems!Your_TextBox_Name.Value,Globals!PageNumber)
By the way, in the Expression dialog of the Text Box, I had a red line and show the same prompt message with you. It might be caused that the GetGroupPageNumber() function is not a built-in function in Reporting Services.
Best Regards,
Bin Long
Free Windows Admin Tool Kit Click here and download it now
April 27th, 2011 1:49am
Thank you. It worked!!!!Ajit
April 27th, 2011 9:56am
Bin Long/Tony,
The solution worked while displaying the report. But while printing or exporting to pdf, it's completely out of order. Page increments are not happening, page breaks happens very abruptly. Have you experienced this issue ? Any suggestions ?
Regards,
Ajit
Ajit
Free Windows Admin Tool Kit Click here and download it now
May 12th, 2011 3:24pm