question

Santhoshh avatar image
Santhoshh asked

SSRS Page Numbers

Hi, I have a report where there is a requirment to show the Page numbers in a table.since the Built in function for Page Number can be used only in a header or a footer , I need a help where i need to show the page number in a table. Please let me know if there is a way to represent page number in a table. Thanks, Santhosh
ssrs-2008
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Usman Butt avatar image Usman Butt commented ·
There is a workaround to handle it in TSQL, but for that you should know how many rows be displayed in a page OR each group is shown on its own page. Are you comfortable with that?
0 Likes 0 ·
Santhoshh avatar image Santhoshh commented ·
I guess its around 40 rows per page
0 Likes 0 ·

1 Answer

·
Usman Butt avatar image
Usman Butt answered
The workaround is to add another column in your DataSource which would act as a dummy page breaker and its value would serve as the PageNumber. i.e SELECT ROW_NUMBER() OVER (ORDER BY PRIMARYCOLUMN_OR_ANYCOLUMN)/ 40 + 1 PageNumber, OTHERCOLUMN... FROM YOURTABLE Add this column as the Parent Group and In Group Properties -> Page Break Options -> Check "Between each instance of a group". Then you can show the PageNumber Column as the PageNumber. But mind you this would limit the number of rows in a page to 40. If you want more rows then change it accordingly.
5 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Santhoshh avatar image Santhoshh commented ·
Hey Usman, Thanks for giving a solution which worked for me. I just did a small work around and i have come up with a similar kind of solution but which follows the same approach as you have ad-viced to. Here it goes instead of fetching these page numbers from the query or data source, we can use the inbuilt function of report expression. Ur approach: SELECT ROW_NUMBER() OVER (ORDER BY PRIMARYCOLUMN_OR_ANYCOLUMN)/ 40 + 1 PageNumber, OTHERCOLUMN... FROM YOURTABLE Which is returning from the data set New Approach with base line as above: Try using the in - built function RowNumber() within the Expression and modify above query to SSRS expression as shown below "Int((RowNumber("dsQuoteDetails"))/40 +1)" This expression gives the same results as in former but the only change in latter is the result set is not being fetched by the data set but is calculated and displayed during run time. But Usman Thanks for the suggestion and solution. Thanks, Santhosh
1 Like 1 ·
Usman Butt avatar image Usman Butt commented ·
@Santhoshh Glad to know that. But if you find my answer helpful, then please accept the answer. It will help the future users.
0 Likes 0 ·
Santhoshh avatar image Santhoshh commented ·
Hey Usman please let me if it is not accepted because i have accepted it but need a confirmation
0 Likes 0 ·
Usman Butt avatar image Usman Butt commented ·
There is a tick mark against the answer. Click that. And If you get prompted for confirmation, then please confirm it.
0 Likes 0 ·
Santhoshh avatar image Santhoshh commented ·
I guess its answered, anyways thank you.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.