{"id":132,"date":"2010-07-22T13:57:00","date_gmt":"2010-07-22T08:27:00","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=132"},"modified":"2010-07-22T13:57:00","modified_gmt":"2010-07-22T08:27:00","slug":"how-to-display-fixed-number-of-rows-in-a-table-using-srs-report","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2010\/07\/how-to-display-fixed-number-of-rows-in-a-table-using-srs-report\/","title":{"rendered":"How to display fixed number of rows in a table using SRS Report"},"content":{"rendered":"<p><span>There are times when you would like to restrict the number of rows that are being displayed on one page in a table. By default if you add a table to a report and set the datasource to a dataset, it will list out all the rows of the dataset in there and if the table data exceeds the report page then it moves to the next page. <\/span><br \/><span><br \/>Suppose now you want to make sure that there should be note more than 3 rows on each page in the table, you can achieve this by making the following changes to your report.<br \/>Say the default query being used to retrieve data is the following<br \/><strong><\/strong><br \/><strong>SELECT productdescription, quantity, priceperunit, extendedamount FROM FilteredQuoteDetail <\/strong><\/p>\n<p>And it will display the following result set. <\/span><\/p>\n<p><a href=\"http:\/\/3.bp.blogspot.com\/_pMlyDuF-ngc\/TEhZlZmbtGI\/AAAAAAAAAe8\/r8jHKuAgjvE\/s1600\/6.jpg\"><img decoding=\"async\" src=\"http:\/\/3.bp.blogspot.com\/_pMlyDuF-ngc\/TEhZlZmbtGI\/AAAAAAAAAe8\/r8jHKuAgjvE\/s400\/6.jpg\" border=\"0\" alt=\"\"><\/a><br \/><span>To fix the rows of the page you need to change the Query to create a custom column in the query that you can use for grouping the rows on a page. Lets call that the page number for each of the record.<br \/>We have used the Row_Number() function to group the rows so that there are only 3 rows on each page.<\/p>\n<p><\/span><span><strong>SELECT productdescription, quantity, priceperunit, extendedamount, page = (CASE WHEN (Row_Number()<br \/>OVER (ORDER BY productdescription) % 3 = 0) THEN (Row_Number() OVER (ORDER BY productdescription) \/ 3) &#8211; 1 ELSE (Row_Number() OVER (ORDER BY productdescription)<br \/>\/ 3) END)<br \/>FROM FilteredQuoteDetail<\/strong><\/p>\n<p>It displays the following result set. <\/span><\/p>\n<p><span><br \/><\/span><a href=\"http:\/\/2.bp.blogspot.com\/_pMlyDuF-ngc\/TEhPqunlLaI\/AAAAAAAAAeE\/KzS3ubTk10M\/s1600\/5.jpg\"><img decoding=\"async\" border=\"0\" alt=\"\" src=\"http:\/\/2.bp.blogspot.com\/_pMlyDuF-ngc\/TEhPqunlLaI\/AAAAAAAAAeE\/KzS3ubTk10M\/s400\/5.jpg\"><\/a><br \/><span>Now you need to add the list the on the report page and Group this list by the page column as shown in the below screenshot.<br \/><\/span><br \/><a href=\"http:\/\/4.bp.blogspot.com\/_pMlyDuF-ngc\/TEhQSD41E5I\/AAAAAAAAAeM\/KH2FYJkKzB0\/s1600\/4.jpg\"><img decoding=\"async\" border=\"0\" alt=\"\" src=\"http:\/\/4.bp.blogspot.com\/_pMlyDuF-ngc\/TEhQSD41E5I\/AAAAAAAAAeM\/KH2FYJkKzB0\/s400\/4.jpg\"><\/a><br \/><span>Now add the table under this list. As shown in the below screenshot.<br \/><\/span><br \/><a href=\"http:\/\/3.bp.blogspot.com\/_pMlyDuF-ngc\/TEhQ1elzkyI\/AAAAAAAAAec\/nZtG6g4jrn8\/s1600\/3.jpg\"><img decoding=\"async\" border=\"0\" alt=\"\" src=\"http:\/\/3.bp.blogspot.com\/_pMlyDuF-ngc\/TEhQ1elzkyI\/AAAAAAAAAec\/nZtG6g4jrn8\/s400\/3.jpg\"><\/a><br \/><span>Now you run this report then data display in 2 pages.<br \/><\/span><br \/><a href=\"http:\/\/3.bp.blogspot.com\/_pMlyDuF-ngc\/TEhRD1Fd8rI\/AAAAAAAAAek\/nqfIXBJy0Nc\/s1600\/2.jpg\"><img decoding=\"async\" border=\"0\" alt=\"\" src=\"http:\/\/3.bp.blogspot.com\/_pMlyDuF-ngc\/TEhRD1Fd8rI\/AAAAAAAAAek\/nqfIXBJy0Nc\/s400\/2.jpg\"><\/a><a href=\"http:\/\/4.bp.blogspot.com\/_pMlyDuF-ngc\/TEhRtH39mfI\/AAAAAAAAAe0\/dPtGZUUjVe8\/s1600\/1.jpg\"><img decoding=\"async\" border=\"0\" alt=\"\" src=\"http:\/\/4.bp.blogspot.com\/_pMlyDuF-ngc\/TEhRtH39mfI\/AAAAAAAAAe0\/dPtGZUUjVe8\/s400\/1.jpg\"><\/a><span> There you are!!!<\/span> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are times when you would like to restrict the number of rows that are being displayed on one page in a table. By default if you add a table to a report and set the datasource to a dataset, it will list out all the rows of the dataset in there and if the\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2010\/07\/how-to-display-fixed-number-of-rows-in-a-table-using-srs-report\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[19,58],"tags":[822],"class_list":["post-132","post","type-post","status-publish","format-standard","hentry","category-dynamics-crm","category-ssrs-reports","tag-fixed-row-in-table"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=132"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/132\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}