Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get table row count outside scope of table in SSRS 2008

I can count the rows in the dataset that the table consumes, but this doesn't return the right value as the data in the table is grouped.

I need to know the table size in order to dynamically size a chart that appears along side the table.

CountRows is obviously no good as you have to be in the scope of the table, which I'm not.

Any ideas?

like image 441
adolf garlic Avatar asked Dec 06 '25 06:12

adolf garlic


2 Answers

Add a hidden column to the tablix, and in the header cell place the expression "=CountRows()". Being in the header cell means that the count of all rows not the groups counts. You can then reference the header cell (named something like Textbox10) as an expression elsewhere in the report as "=ReportItems!Textbox10.Value". You could also add a hidden row (not grouped) to the bottom of the tablix, rather than a column, whatever works better for you. Do this by right clicking on the outermost group and selecting "Insert Row" -> "Outside Group - Below".

like image 172
Anthony K Avatar answered Dec 10 '25 02:12

Anthony K


How about determining the number of rows you'll have this way: [# of Header Rows] + CountRows("[DataSetName]") + CountDistinct(Fields![group1groupby].Value, "[DataSetName]") + CountDistinct(Fields![group2groupby].Value, "[DataSetName]") ... etc?

like image 24
utexaspunk Avatar answered Dec 10 '25 01:12

utexaspunk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!