Search This Blog

Limiting Rows or No. of Records in SSRS Report Per Page in SSRS

Limiting Rows or No. of Records in SSRS Report Per Page.

Many times while creating a report you have to limit numbers of Records per page 
for Example there is a requirement like where you have to display 5 records per page next page again 5 records or row upto last record
for this type of scenario

Go to Design of Your Report.
Left hand side row group-Under Row Group add a Row Parent Group 
Do not add Group Header or Footer

Group by- click on Fx - Write expresssion-
=Floor((RowNumber(Nothing) - 1) / 5)
click ok

Or after adding Group Go to Group Properties
Name Group to Group 1 or anything

Now in the General Tab


Group on Click on-fx
check expresssion-
=Floor((RowNumber(Nothing) - 1) / 5)
click ok

Now in the PageBreakTab

Check box-Between each Instance of Group 

click ok

Make Sure In Sorting tab there should be no sorting order if it is there delete it
otherwise it will throw an error

delete the Column which has been generated after adding a column make sure that delete only column 
while deleting it will ask to delete row or column associated with it 


Check Box- Delete the Column only.
Preview the Report-Move to Next Page
There will be 5 records per page

Explanation of Expression: RowNumber(Nothing) is a function to getrownumbers in ssrs 5 will give 5 records per Page This Number i.e 5  you can change it to any number according to your Requirement of records per page.
Floor Function will return largest value by Rounding Off the inner Function.

Note Floor function is only to get largest value of inner Expression you can use other ssrs function like ceiling function to get smallest value of Inner Expression.
If you want to use cieling function change your Expression to 
=Ceiling((RowNumber(Nothing)) / 1)

In order to see difference between Ceiling and Floor check MSDN Link.

http://technet.microsoft.com/en-us/library/ms190927(v=sql.105).aspx 







No comments:

Post a Comment