Monday, January 19, 2009

Display only given number of records per page in SQL Server Reporting Services 2005 (SSRS)

Question:
In SQL Server Reporting Services 2005 (SSRS), how to display only given number of records per page?
Answer:
If you want to display only 20 rows per report page, it is not easy task as number of rows will depend on the font size and other printer defaults. Apart from this problem, if there are rows with lengthy text it tends to move to another line which will upset the number of rows in your report. So it is necessary to add some coding to get this feature to your reports.
Let us say, you want to have only 20 rows per page, add a group to the report with following expression.
=int((RowNumber(Nothing)-1)/20)

Then select page break at the end option for the group.

No comments:

Post a Comment