Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add SSRS page break after 65536 rows, counting group header/footer

I have an SSRS report which is failing to export to excel when the row count is greater than the Excel 2003 limit of 65536

The report already has a grouping level with a group footer.

I have tried to add an extra grouping level with a page break on the expression

=ceiling(rownumber(nothing)/65536)

However, this counts the detail rows, but does not take into account the group footer. So the rownumber evaluates to 53000 while the actual number of rows has exceeded 65536.

The following expression

=ceiling(RunningValue(Fields!myfirstgroup.Value, CountDistinct, Nothing) + rownumber(nothing) / 65536 )

will give me the actual row count including the group footers, but SSRS will not allow a group on a running value expression.

How can I force a page break after 65536 rows to allow an export to Excel? I had hoped to accomplish this in the report definition, and avoid adding a calculated page number in the query .

Any help much appreciated

* UPDATE - Sample data *

ItemDescription , Location , Quantity

Red lorry , M25 , 5

Red lorry , M6 , 2

Yellow lorry , M1 , 3

Report has a grouping on ItemDescription with a total for that item, so it will show

ItemDescription , Location , Quantity

    Red lorry , M25 , 5

    Red lorry , M6 , 2

      Total for Red Lorry,7

    Yellow lorry , M1 , 3

      Total for Yellow Lorry,3

This means from my 3 rows of data, I have 5 report rows including detail and footer rows. SSRS can tell how many details rows are in my dataset, but I need to take the footers into account for a page break.

like image 289
JamieA Avatar asked Sep 25 '13 11:09

JamieA


People also ask

How do I add a line break in SSRS expression?

Using Newline function Make use of Environment. NewLine() function to add line break within the expression.

How do I limit the number of rows per page in SSRS?

If no grouping by Category, I can limit the number of rows per page by Add group example group G1 which contains expression : Int((RowNumber(Nothing)-1)/10). This will limit maximum 10 rows per page.

How do I add page numbers to a footer in SSRS?

To add a page number or other report properties In the Report Data pane, expand the Built-in Fields folder. If you don't see the Report Data pane, on the View tab, check Report Data. Drag the Page Number field from the Report Data pane to the report header or footer.


2 Answers

Hi this link might help you. I had similar sort of issue, a few years back.

SSRS Page break on Tablix with Rownumber ,just one row group and no group expression given by default

=Floor((RowNumber(Nothing)-1)/2000)

was the suggested answer

like image 80
Rohith Nair Avatar answered Sep 23 '22 14:09

Rohith Nair


Create a group with the following expression: =CInt(Ceiling(RowNumber(nothing)/65000))

The 65000 give you a little extra room for any headers or footers. Next, do a Page Break on this group "Between each instance of a group" and "Also at the end of a group" and you will successfully beat the excel file limit issue.

This is what we normally use without any issue. I don't think any one will notice if you don't specifically use all 65,536 rows.

like image 25
buzzzzjay Avatar answered Sep 22 '22 14:09

buzzzzjay