This is a migrated thread and some comments may be shown as answers.

Report Record Count

28 Answers 2737 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 28 Jan 2009, 01:02 PM
I am trying to figure out a way to determine the record count of the report (Number of records for the detail section).  I realize that there is a page count, but is there a way to get the total record count.  I would like to display this somewhere on the top of the report.

Thanks!

28 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 28 Jan 2009, 01:59 PM
Hi Jason,

You can use the RowCount() built-in function for this purpose.

Sincerely yours,
Steve
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jason
Top achievements
Rank 1
answered on 28 Jan 2009, 02:15 PM
I am using Q2 2008 and I don't see a RowCount function.  The only function relating to Rows is the RowNumber function.
0
Steve
Telerik team
answered on 28 Jan 2009, 02:38 PM
Hello Jason,

Indeed I was referring to the RowNumber function - sorry for the confusion.

Best wishes,
Steve
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jason
Top achievements
Rank 1
answered on 28 Jan 2009, 02:57 PM
The RowNumber() function will provide the row number for each record in the detail section, but I would like to actually have a record count of all of the records to display in the header of the report.  Ex.  The report shows that there are 24 pages to the report.  I would like to display that there are 24 pages and 192 records total.  Is this possible? 

I can get the recordcount in the code-behind page, but I can't figure out how to display that on the report.  If I use a public shared function, I am unable to reference the record count from the code-behind even if I make the record count a global variable.  You can't reference a global variable from a shared function. 

Code Below:
-----------------------------------------------------------------------------------------------------

Public iCount As Integer

Private Sub FacilitiesByAO_NeedDataSource(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.NeedDataSource
    Dim oDBAccess As New cDBAccess  'Custom Class that builds a dataset
    oDBAccess.Open(sSQLStatement)
    iCount = oDBAccess.RecordCount ' iCount is populated properly with the record count (Number of rows returned)
    Dim Report As Telerik.Reporting.Processing.Report = sender
    Dim view As DataView
    view = oDBAccess.DS.Tables(0).DefaultView
    Report.DataSource = view
End Sub

Public Shared Function RecordCount() As String
    Return iCount.ToString 'This line will not work because it is referencing a class variable
End Function

 

-----------------------------------------------------------------------------------------------------

Thanks for your help.

0
Accepted
Steve
Telerik team
answered on 28 Jan 2009, 03:36 PM
Hi Jason,

Actually my idea was to point you to an unique row identifier that can be used as argument in Count() aggregate function, which would give you the record count i.e. =Count(RowNumber()). Your solution can also work, but you would have to make the iCount field Shared as well in order to use it in a shared method.

Best wishes,
Steve
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jason
Top achievements
Rank 1
answered on 28 Jan 2009, 06:01 PM
The =Count(RowNumber()) was exactly what I was looking for.  It is also a cleaner solution.  Now I can go back to a SqlDataAdapter and remove the NeedDataSource Event.

Thanks for your help!

Jason
0
Bob
Top achievements
Rank 1
answered on 25 Nov 2010, 01:35 AM
Hello,

I want to count the number of rows with a certain condition, e.g. =Count(field.status = 'On-Time').  I would expect this would count only the rows that where the expression evaluates to true, however, it does not.  It appears that count always returns the number of rows regardless of what column name you use as a parameter, which makes the parameter seem useless.  Certainly, I am missing something here.

How can I accomplish this?

TIA

Bob
0
Steve
Telerik team
answered on 25 Nov 2010, 05:22 PM
Hi Bob,

The Count function returns a count of all non null values from the specified expression. So you can achieve this with a proper expression:

=Count(IIf(Fields.status = 'On-Time', 1, null))

Sincerely yours,
Steve
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
0
Bob
Top achievements
Rank 1
answered on 26 Nov 2010, 05:20 PM
Steve,

Thanks, that does the trick.

Bob
0
Kumron
Top achievements
Rank 1
answered on 24 Sep 2011, 09:29 AM
if use bindings
DataSource = ReportItem.Parent.DataObject

function RowNumber() not work. it show number "1"  all rows.
0
Steve
Telerik team
answered on 28 Sep 2011, 04:26 PM
Hello Kumron,

As you can see from the documentation, the RowNumber(scope) function returns a running count of all rows in a specified scope. More information about the Expression scope is available in the referenced help article.

All the best,
Steve
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Geoffrey
Top achievements
Rank 1
answered on 10 Jul 2013, 03:41 PM
I used that method but I got a error 

"Aggregate/RowNumber/ColumnNumber functions cannot be nested."

Is there something I'm missing?
0
Stef
Telerik team
answered on 15 Jul 2013, 02:59 PM
Hello Geoffrey,

Since the initial implementation of the RowNumber function, we improved it to support scope and now it works as running aggregate and aggregate functions do not allow nesting.

To accomplish your task set an expression using the Count aggregate like:

= Count(Fields.SomeField)

If you need further help, please elaborate on the scenario and what accumulations have to be added to your report definition.

Regards,
Stef
Telerik

Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.

0
Geoffrey
Top achievements
Rank 1
answered on 15 Jul 2013, 03:38 PM
Basically, here is the scenario: I have some data being displayed in my report via ObjectDataSource, I have to additional fields that I have added (Row Count, and CheckBox). At the top of the report I have a textbox that will display the total number of rows. Here is an illustration:


    Total Number of Rows: 2
   TextField 1: Data
   TextField 2: Data
   Row Number:  1 

   TextField 1: Data
   TextField 2: Data
   Row Number:  2 

    
 This is pretty much what I would like to accomplish my report.  Can you help?
0
Stef
Telerik team
answered on 18 Jul 2013, 07:44 PM
Hi Geoffrey,

Try using Data Functions to get the number of records. In the attached example report definition, in a group section is used the Exec data function where the scope is the whole report, and we count how many times there is a certain field in the report.

If you need further help, please open a support ticket and send us mode tails about your report layout and the needed count.

Regards,
Stef
Telerik

Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.

0
Per
Top achievements
Rank 1
answered on 01 Oct 2013, 09:05 AM
Hello,

I have a data field that I use to group my data by.
In each group I would like to show the group number in a textbox

Group 1
detail section
Group 2
detail section

and so on.

Is there a way to e.g. add a counter that shows the current group?

BR,
Per
0
Per
Top achievements
Rank 1
answered on 03 Oct 2013, 08:34 AM
No answer so I had to solve it myself.

I did add a user defined function in my ClassLib for those who might want to know.

Thanks!
0
Jolanta
Top achievements
Rank 1
Veteran
answered on 13 Jul 2015, 05:33 AM

Hi, maybe it does not fit the main topic, but I hope to use RowNumber?

I have a groupHeader section, where I display grouped data. After each group member, a pageBreak is used (property pageBreak set to after for this section).

A the same moment, I would like to display a footer, which generally should be not visible (property set to false). I wanted to use Bindings and there set the property Visible to true under condition, after each group member of the groupHeader section. 

Do you know any solution for that?

Jola

0
Stef
Telerik team
answered on 14 Jul 2015, 12:34 PM
Hello Jola,

I am uncertain about the desired report layout., but please check if using conditional page breaks helps you to achieve it

More details about the available data functions can be found here.

Regards,
Stef
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jolanta
Top achievements
Rank 1
Veteran
answered on 14 Jul 2015, 04:54 PM

Hi Stef,

thanx for answer, in fact I want to gain this:

I have section with grouping, after each group member page break appears. Just in this moment, I want the footer to be visible, and only at this page, where the particular group member ends. Nowhere else - just before the moment of the group page-break-after.

 Jola

0
Stef
Telerik team
answered on 17 Jul 2015, 07:05 AM
Hi Jola,

Most probably you have set the group sections' PrintOnEveryPage property to true which causes the sections to appear on each physical page. If I have misunderstood you, please add screenshots with remarks what is illustrated on them and what is the expected result.

Regards,
Stef
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Pushkar
Top achievements
Rank 1
answered on 04 Aug 2016, 09:11 AM
I am getting only one record in my telerik report. but i am getting all records in query browser
0
Pierre
Top achievements
Rank 1
answered on 04 Aug 2016, 09:48 AM

@ Pushkar:
Tell me more !
 - What is the item displaying the data ? ( Table, Textbox , .. )
 - Where is the Datasource bound ? is the Data Bound to the report himself ?
To the table ? 
 - Any filter ?

 - Are you using some ReportParam ? Can you display it to be sure you re not getting the default one ?

0
Pushkar
Top achievements
Rank 1
answered on 04 Aug 2016, 09:55 AM

- it is displaying table

- datasource is bound using inline select query in sql datasource. yes to the table

- no filter is there

- i am using 4 report parameters, from date, to date, dattype (coming from stored procedure) and name(coming from inline query)

0
Pushkar
Top achievements
Rank 1
answered on 04 Aug 2016, 09:57 AM
i should get these rows as shown in the attachment, but i amd seeing only one row
0
Pushkar
Top achievements
Rank 1
answered on 04 Aug 2016, 10:00 AM
please reply asap
0
Pierre
Top achievements
Rank 1
answered on 04 Aug 2016, 10:10 AM
Hi Pushkar,
try to reproduce the weird behavior with a simple table.
A New one, bound to the same datasource dont recreat the query or anything, the same one.
Use header to display key paramters( Im pretty sure this is the issue)
In the table cell display some random data Owner name.

If the displayed Params give you different result in the new Table and in the Querry builder.
I wont be able to help you. You better open a ticket or wait for Admin here.

Regards,
Pierre LEBON
0
Katia
Telerik team
answered on 05 Aug 2016, 01:36 PM
Hello Pushkar,

Double check the filters applied to the table or SqlDataSource component.

To provide you further suggestions we would need to check the report's settings. Please open a support ticket and attach the problematic report with test data if possible.


Regards,
Katia
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Jason
Top achievements
Rank 1
Answers by
Steve
Telerik team
Jason
Top achievements
Rank 1
Bob
Top achievements
Rank 1
Kumron
Top achievements
Rank 1
Geoffrey
Top achievements
Rank 1
Stef
Telerik team
Per
Top achievements
Rank 1
Jolanta
Top achievements
Rank 1
Veteran
Pushkar
Top achievements
Rank 1
Pierre
Top achievements
Rank 1
Katia
Telerik team
Share this question
or