How to get record count or row count of rows in reporting service table object?

SSRS 2005.  Let's say I define ONE dataset.  In the page layout I drop in 2 tables.  table1 and table2.  In each of these 2 tables, I add a filter. Let's call the field Active Flag, and I filter on "Y" and "No" respectively.  Now, at the bottom of the report(and not inside the tables themselves) I want to drop 2 textboxes onto the page layout.  I want to get the record count from table1, and the record count in table 2, and place it in each textbox at the bottom of the page that shows the total records per table.  Sounds easy, but when you do COUNT("table1") or COUNT("table2"), it returns the entire row count from the dataset, it does not take into account the filter on the table.  So, the table might show 5 records, but the COUNT function will still return like 100, since that includes all the records. Is there something else I should use to get the count?  I don't want to make more than 1 dataset, and I don't want to return the count from the dataset by adding fields to the proc that returns the counts.  Any thoughts on how this simple idea is suppose to work?




12/4/2008 2:45:36 AM 4514 articles. 1 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 31

Use this expression where ever you like


if you add above expression into a new column in table 1 you'll see the exact number of the your filtered rows , and you can use the Last one as the count


let me know what's happen to your report after applying this , or mark this as answer , best regards

Nasser Hajloo
Tehran , Iran , Middle east
12/4/2008 8:13:07 AM

Thanks for the reply.  However, RowNumber also ignored the filter.

Let me restate, my requirement is to show the row count, but not in a cell within the table.  Calculations have to be performed outside the table at the bottom of the page, which will also take into account counts from other tables on the page.  Apparently, there is no way to get a count by referencing a table if you are not in a cell within the table.  I would surely hope there is a way to do this, as I have ran into this often, but I have always had to create 2 datasets before, which basically means running the query twice. However, I have found a work around for now:

Add a footer to the table, in a footer cell, use COUNT("fieldname"). Lets call that cell textbox17.  Now, outside of the table, you can drag a textbox onto the bottom of the page, lets call it textbox20.  In textbox20, you can put =ReportItems!textbox17.Value.  Of course, I also have to set the footer to not be visible, since they don't want to see the total in the footer, but rather in a diferrent location on the page.  I guess I don't understand why I can't use COUNT("table1") outside of the table to get the count of what is displayed.  I guess my workout will work though.

12/4/2008 4:36:06 PM

Similar Artilces:

record count, row count?
how can I get a count of records/rows in my datawindow? I want to know how big the datawindow record set is so I can loop through my data. For example... for i = 1 to lng_datacount // copy from dw_2 , column 3 to dw_1 , column 1 dw_1.Object.Data[i,1] = dw_2.Object.Data[i,3] // this is row,column next -- Ken Goudsward long ll_rowcnt ll_rowcnt = dw_1.RowCount() -- Terry Dykstra (TeamSybase) Please state PB / OS / DB versions in your post. MySybase Search Deja: "Ken Goudswar...

Rows.Count not counting
In the code below, no matter how many records the following select statement returns dt2.rows.count always = 0, so the file delete commands never run any suggestions?  private void FileCheck() {System.Data.SqlClient.SqlDataAdapter ada2 = new System.Data.SqlClient.SqlDataAdapter("SELECT [idnumber], [picturesmallURL], [picturemediumURL], [picturelargeURL] FROM [inventory] WHERE [picturesmallURL] = '" + smlpicval + "'" , System.Web.Configuration.WebConfigurationManager.ConnectionStrings["donatoConnectionString"].ConnectionString);DataTable dt2...

problem with row count in database and represent the row count in label
 Does anyone know how to represent number of rows in a table from database into a label or TextBox                                                Thanks Hi spike,If you have a DataTable with rows then you would have to use:this.myLabel.Text = myDataTable.Rows.Count.ToString();Good Coding!Javier Luna from ...

Get a Table's Row Count from system tables
Anyone knows how to get a Table's Row Count from system tables? Thanks. Please mark the post(s) that have helped you as "Answer" select count(*) from sysobjects sysobjects is a system table name. Replace this with the system table name which you want to get the row count.Kusal WijewanthaSenior Software Developer SSW

Getting Row Counts for ALL Tables
Hello. I am using an ASA 8 database and would like to produce a report showing each table and the number of rows for each. Does anyone know of a system procedure to accomplish this? When using Sybase at my previous employer, I thought I used something like a sp_spaceused system stored procedure, or something like that. I see that ASA 8 has a SP named this, but it looks like a stub that doesn't really do anything. I haven't been using ASA 8 for that long, so it could well be something fairly obvious that I'm missing. In any case, any advice on this matter would be ...

How to get the row count in a report.
Hi guys, in my code i am calling a crystal report which gets its data from a stored proceedure(which is a simple Select query). I am looking forward to get the number of rows the stored proceedure returns. Is there a way I can get that number in my crystal report? Thanks in advance..... Rajdot Net Developer. You can use the count(field) function which will tell you how many times specific field is included which is essentially the same as SELECT Count(*) .... . Be careful because it is dependant on which Group you place the summary unless you use the count(field,condField) where t...

dataview.count VS dataview.table.row.count
Can someone explain to me why the two are not returning the same number of row. It seems that GetSelectedFunction with gdvFunction.Table.Rows.Count - 1 returns over a 1000 rows when PopulateFunctionDD that fills the dataview return only 5 rows with the filter applied(when I do gdvFunction.Count in my command window) . And if this is normal how can I loop through the filtered dataview information? Private gdvFunction As New DataView '********************************************************************************** '*******************************************************...

Getting Table Row Count from DataSet
Can't figure out how to check for DataSet Table Row Count - below code not working, say not properly constructed  try{  da.Fill(ds, "WordstrSearch");return ds.Tables["WordstrSearch"];}if ( ds.Tables["WordstrSearch"].Rows.Count > 0){  Label1.Visible = False;  }   Doesn't look like your code will ever reach the part that tests the row count because you're returning a datatable before it reaches the block.Rob Please post your full code. What you are doing should get you the r...

Reporting row counts in db tables
Has anyone written an SQL script or a stored proc that will report the name of each user table in a database and the number of rows in each? Thanks This is what I use on 11.0. For 11.9, you can read systabstats, I believe. Bob SELECT "Table Name" =, "Index Name" =, "Data Pages" = data_pgs(,doampg), "Index Pages" = data_pgs(,ioampg), "RowCount" = rowcnt(doampg) FROM sysindexes i,sysobjects o WHERE -- indid in (0,1) AND = AND o.type = ...

How do I join two tables to get a row count?
I have two tables: Thread and Reply and they both have a field called UserID I need to know the number of rows in both tables where UserID="Chris" I can do this with two stored procedures and add the results together: SELECT COUNT(*) FROM Thread WHERE Thread.UserID='Chris' SELECT COUNT(*) FROM Reply WHERE Reply.UserID='Chris' but there must be a better way.  Can this be written as one stored procedure with some sort of join? Thanks, Chris Try something like this: select  (select count(user_id) from table1 where userID = 'blah' )   + (select count(...

Excel application in .NET
Hello,Can anyone please tell me how to get the total number of rows in an excel sheet. Thanks I know Excel is not tabular but try the links below for more info, and play with the save as option in Excel 2003 I think one is close to your needs.  Hope this helps. regards,Gift Peddie...

count rows without count(*)
Hi all, I get data from DB with: while (my ($id, $post_text) = $getpost->fetchrow_array) { is there a way how much columns are selected wihout select (fetch) them all, or using count(*) function ? Thanks Ing. Branislav Gerzo wrote: > Hi all, > > I get data from DB with: > while (my ($id, $post_text) = $getpost->fetchrow_array) { > > is there a way how much columns are selected wihout select (fetch) > them all, or using count(*) function ? In the general case, no. DBI provides the rows() method: my $rows = $sth->rows; But for a ...

How to count cursor row count ??
Hi Experts : I declar a cursor , just like : DECLARE lcur_empm185 CURSOR FOR SELECT emp.empm185.empno, emp.empm185.cname, emp.empm185.empid, emp.empm185.hinsuramt, emp.empm185.helthamt FROM emp.empm185 WHERE ( emp.empm185.insuranceday <= :ldt_date ) ; How to get the "lcur_empm185 " row count ? I use PB6.0 & Informix 7.x TK's Destroy the cursor. Use a datastore. "wang wei" <> wrote in message news:vG4jgdmf$ > Hi Experts : > ...

using cursor to get a row count for all user tables...
Please help me troubleshoot the below code. I'm trying to convert it over from MS SQL Server to Sybase. The MS SQL Server code is very similar to Sybase ASE, but different in places. I'm hoping that the below code is correct and will work on ASE, but was hoping to get your feedback. Is there a better way to do this? ------------------------------------------------ declare table_cursor cursor for select name from sysobjects where type='U' for read only declare @table_name sysname set @total_recs = 0 open table_cursor fetch table_curso...

Web resources about - How to get record count or row count of rows in reporting service table object? -

Reporting - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Contract Analyst Programmer (Reporting/.Net) 151223/AP/266
Defining Technology for Australia's IT Leaders.

Banks playing key role in reporting transactions with suspected terrorism links, Austrac says
Australia's financial intelligence agency Austrac is monitoring the financial DNA of those Australians likely to transfer money to fund Islamic ...

Facebook Improves Real-Names Policy Reporting, Verifying
Facebook took its latest steps to reform its controversial real-names policy with its introduction of tools to fine-tune the reporting process ...

NYT public editor rips San Bernardino reporting - Business Insider Deutschland
The New York Times' public editor called for "systemic change" after an article incorrectly stated Tashfeen Malik posted openly on social media ...

New technology offers on-field head injury reporting
Experts hope system will help get student athletes the speedy treatment they need after head injuries such as concussions

Ford changes pension reporting
Ford said it will restate its financial results since 2011 and show a $1.5 billion rise in 2015 pretax profit as it changes its pension reporting. ...

ObamaCare Reporting Deadline Pushed Back For Employers
The agencies say most taxpayers won't be affected by the extension

New York Times tries and fails to fix its own botched San Bernardino reporting
The New York Times has corrected its massively botched story on the San Bernardino terrorists . Kinda sorta. The story by past reporting-botchers ...

What Flap Over Reporting Instagram Flaw to Facebook Teaches Us
NEWS ANALYSIS: In a public spat, a security researcher lashes out at Facebook about a reported Instagram bug, and Facebook's chief security officer ...

Resources last updated: 1/7/2016 11:18:25 PM