Report Record Count

29 posts, 1 answers
  1. Jason
    Jason avatar
    22 posts
    Member since:
    Sep 2007

    Posted 28 Jan 2009 Link to this post

    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!
  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 28 Jan 2009 Link to this post

    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.
  3. DevCraft banner
  4. Jason
    Jason avatar
    22 posts
    Member since:
    Sep 2007

    Posted 28 Jan 2009 Link to this post

    I am using Q2 2008 and I don't see a RowCount function.  The only function relating to Rows is the RowNumber function.
  5. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 28 Jan 2009 Link to this post

    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.
  6. Jason
    Jason avatar
    22 posts
    Member since:
    Sep 2007

    Posted 28 Jan 2009 Link to this post

    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.

  7. Answer
    Steve
    Admin
    Steve avatar
    10941 posts

    Posted 28 Jan 2009 Link to this post

    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.
  8. Jason
    Jason avatar
    22 posts
    Member since:
    Sep 2007

    Posted 28 Jan 2009 Link to this post

    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
  9. Bob
    Bob avatar
    27 posts
    Member since:
    May 2007

    Posted 24 Nov 2010 Link to this post

    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
  10. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 25 Nov 2010 Link to this post

    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.
  11. Bob
    Bob avatar
    27 posts
    Member since:
    May 2007

    Posted 26 Nov 2010 Link to this post

    Steve,

    Thanks, that does the trick.

    Bob
  12. Kumron
    Kumron avatar
    2 posts
    Member since:
    Sep 2011

    Posted 24 Sep 2011 Link to this post

    if use bindings
    DataSource = ReportItem.Parent.DataObject

    function RowNumber() not work. it show number "1"  all rows.
  13. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 28 Sep 2011 Link to this post

    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 >>

  14. Geoffrey
    Geoffrey avatar
    2 posts
    Member since:
    Jun 2013

    Posted 10 Jul 2013 Link to this post

    I used that method but I got a error 

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

    Is there something I'm missing?
  15. Stef
    Admin
    Stef avatar
    3036 posts

    Posted 15 Jul 2013 Link to this post

    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.

  16. Geoffrey
    Geoffrey avatar
    2 posts
    Member since:
    Jun 2013

    Posted 15 Jul 2013 Link to this post

    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?
  17. Stef
    Admin
    Stef avatar
    3036 posts

    Posted 18 Jul 2013 Link to this post

    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.

  18. Per
    Per avatar
    13 posts
    Member since:
    Feb 2013

    Posted 01 Oct 2013 Link to this post

    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
  19. Per
    Per avatar
    13 posts
    Member since:
    Feb 2013

    Posted 03 Oct 2013 Link to this post

    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!
  20. Jolanta
    Jolanta avatar
    19 posts
    Member since:
    Oct 2014

    Posted 13 Jul 2015 Link to this post

    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

  21. Stef
    Admin
    Stef avatar
    3036 posts

    Posted 14 Jul 2015 Link to this post

    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
  22. Jolanta
    Jolanta avatar
    19 posts
    Member since:
    Oct 2014

    Posted 14 Jul 2015 in reply to Stef Link to this post

    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

  23. Stef
    Admin
    Stef avatar
    3036 posts

    Posted 17 Jul 2015 Link to this post

    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
  24. Pushkar
    Pushkar avatar
    4 posts
    Member since:
    Jul 2013

    Posted 04 Aug Link to this post

    I am getting only one record in my telerik report. but i am getting all records in query browser
  25. Pierre
    Pierre avatar
    56 posts
    Member since:
    Jun 2016

    Posted 04 Aug in reply to Pushkar Link to this post

    @ 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 ?

  26. Pushkar
    Pushkar avatar
    4 posts
    Member since:
    Jul 2013

    Posted 04 Aug in reply to Pierre Link to this post

    - 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)

  27. Pushkar
    Pushkar avatar
    4 posts
    Member since:
    Jul 2013

    Posted 04 Aug in reply to Pushkar Link to this post

    i should get these rows as shown in the attachment, but i amd seeing only one row
  28. Pushkar
    Pushkar avatar
    4 posts
    Member since:
    Jul 2013

    Posted 04 Aug Link to this post

    please reply asap
  29. Pierre
    Pierre avatar
    56 posts
    Member since:
    Jun 2016

    Posted 04 Aug in reply to Pushkar Link to this post

    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
  30. Katia
    Admin
    Katia avatar
    299 posts

    Posted 05 Aug Link to this post

    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
Back to Top
DevCraft banner