Author |
Topic |
Peace2007
Posting Yak Master
239 Posts |
Posted - 2008-09-01 : 03:09:20
|
Hi, I have a table in my report and I need to display number of table rows in a separate field. I don't know how to calculate table rows. Any idea is appreciated |
|
harlingtonthewizard
Constraint Violating Yak Guru
352 Posts |
Posted - 2008-09-02 : 07:37:49
|
http://weblogs.sqlteam.com/mladenp/archive/2008/02/04/Back-to-Basics-Count-Count-Count-Sum-or-how-to.aspx |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-02 : 10:11:35
|
you can use CountRows() function on dataset and count the number of rows returned to table. |
 |
|
Peace2007
Posting Yak Master
239 Posts |
Posted - 2008-09-03 : 08:00:38
|
Thanks all it works now :) |
 |
|
Peace2007
Posting Yak Master
239 Posts |
Posted - 2008-09-24 : 07:04:34
|
CountRows() works fine on regular reports but I'm having a table in my report, which is filtered on a specific value. But CountRows() displays the real rows count. Do you have any idea about how to display filtered table rows? |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-24 : 07:28:34
|
quote: Originally posted by Peace2007 CountRows() works fine on regular reports but I'm having a table in my report, which is filtered on a specific value. But CountRows() displays the real rows count. Do you have any idea about how to display filtered table rows?
you can use scope information inside countrowscountrows("TableName") should give you the number of rows available in table after filteration. |
 |
|
Peace2007
Posting Yak Master
239 Posts |
Posted - 2008-09-24 : 07:39:10
|
I did but it gives this error: The Value expression for the textbox ‘textbox7’ has a scope parameter that is not valid for an aggregate function. The scope parameter must be set to a string constant that is equal to either the name of a containing group, the name of a containing data region, or the name of a data set. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-24 : 08:11:16
|
quote: Originally posted by Peace2007 I did but it gives this error: The Value expression for the textbox ‘textbox7’ has a scope parameter that is not valid for an aggregate function. The scope parameter must be set to a string constant that is equal to either the name of a containing group, the name of a containing data region, or the name of a data set.
isnt textbox linked to some dataset i.e inside a container? |
 |
|
Peace2007
Posting Yak Master
239 Posts |
Posted - 2008-09-27 : 00:49:44
|
In textbox properties, I've set Data Region to 'table1', which is the name of the table in my report. And the value of the textbox is set to '=CountRows("table1")'but I'm given following error: Error 1 [rsInvalidAggregateScope] The Value expression for the textbox ‘textbox7’ has a scope parameter that is not valid for an aggregate function. The scope parameter must be set to a string constant that is equal to either the name of a containing group, the name of a containing data region, or the name of a data set. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-28 : 03:50:23
|
quote: Originally posted by Peace2007 In textbox properties, I've set Data Region to 'table1', which is the name of the table in my report. And the value of the textbox is set to '=CountRows("table1")'but I'm given following error: Error 1 [rsInvalidAggregateScope] The Value expression for the textbox ‘textbox7’ has a scope parameter that is not valid for an aggregate function. The scope parameter must be set to a string constant that is equal to either the name of a containing group, the name of a containing data region, or the name of a data set.
just add a header row to table and try adding the above expresion to it and see if it works. |
 |
|
Peace2007
Posting Yak Master
239 Posts |
Posted - 2008-09-28 : 07:17:22
|
it displays the count of all rows :) |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-29 : 01:31:30
|
quote: Originally posted by Peace2007 it displays the count of all rows :)
even after giving the scope? |
 |
|
Peace2007
Posting Yak Master
239 Posts |
Posted - 2008-09-29 : 01:55:30
|
Maybe I'm going into wrong steps; I've inserted a row to the table and set its value to =CountRows("table1"). |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-29 : 02:00:45
|
quote: Originally posted by Peace2007 Maybe I'm going into wrong steps; I've inserted a row to the table and set its value to =CountRows("table1").
you mean header row or detail row? |
 |
|
Peace2007
Posting Yak Master
239 Posts |
Posted - 2008-09-29 : 02:22:00
|
I'd made a silly mistake, so sorry Visakh I'd filtered the table row instead of the dataset, that's why the CountRows was displaying the whole row count. I put the filter on the dataset and it works fine now Thanks a million for your comments |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-29 : 02:51:43
|
quote: Originally posted by Peace2007 I'd made a silly mistake, so sorry Visakh I'd filtered the table row instead of the dataset, that's why the CountRows was displaying the whole row count. I put the filter on the dataset and it works fine now Thanks a million for your comments 
no worries Glad that you sorted it out |
 |
|
|