| Recently a couple of my SQL Server Reporting Services clients have asked, how can they add a page break after a specific number of records in a tablix object. 
 
 To give them a bit more flexibility I decided to add a parameter, that allowed them to change the number of records per page
 
 Solution: 
 Create a new report, and the required datasource and datasetCreate a Parameter field:
 
 General - Name: NoRecords
 Prompt: Enter No of Records Per Page
 Data Type: Integer
 Select Parameter Visibility: Visible
 
 
Default Values -Specifiy Value - Value 25
 
 
 
Add a Tablix object to the canvasAdd the required fields to the tablixClick on any cell in the tablix
Right Click on the Detail Row selection buttonSelect Add Group - Row Group - Parent GroupIn the Tablix Group dialog box, in the Group By expression box, enter:
 =CEILING(RowNumber(Nothing)/Parameters!NoRecords.Value)
 
 
Press the OK button
 This adds a Group 1 section to the tablix, and in the Row Group Section at the bottom of the screen
 
 
In the Row Groups section at the bottom of the screen, select the down arrow of Group 1Select the Group PropertiesIn the Group Properties dialog box:
 
General - Name: Page_Break_Group
 
Page Breaks - Between each instance of a group
 
Sorting - Select the Sort expression column and press the Delete button
 
 Press the OK button
 
On the tablix, Right click the Group 1 columnSelect Delete Columnsin the Delete Columns dialog box, select the Delete Columns onlyPress the OK button
 The report now only displays 25 records per page, but will change based on the value entered in the parameter
 If you have any questions, leave us a comment below, or need any assistance, please do not hesitate to Contact Us |