locked
Getting a count of records RRS feed

  • Question

  • User746043490 posted

    Greetings!

    On my SQL report, I have a List and in that List I have three tables that display data. How does one go about getting a count of the total number of records? There is one record per list..

     

    thoughts?

    thanks

    Tuesday, December 31, 2013 3:59 PM

Answers

  • User281315223 posted

    I'm not sure exactly how you want to handle this (through either server-side or client-side code), but I suppose that you could do that through a little bit of Javascript : 

    <script type='text/javascript'>
        //Number of list boxes on the client
        var listboxes = document.getElementsByTagName("SELECT").length;
    
        //Alert the number present
        alert("There are " + listboxes + " listboxes");
    </script>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, January 3, 2014 12:23 PM

All replies

  • User281315223 posted

    I suppose it's a bit difficult to determine exactly what you are asking. Typically, you can use the COUNT(*) function within SQL statements to return the number of rows in a given table and if you have three tables, you could perform a UNION on them to grab how many rows were contained in all of the tables : 

    SELECT COUNT(*) 
      FROM (SELECT * FROM TableA UNION 
            SELECT * FROM TableB UNION
            SELECT * FROM TableC) AS UnionedTable
    Tuesday, December 31, 2013 4:19 PM
  • User746043490 posted

    Yes, I could do that but I don't have access to edit the stored procedures. Since there is only one record per list box, I "should" be able to just count how many Listboxes are on the page, correct?

    Friday, January 3, 2014 11:59 AM
  • User281315223 posted

    I'm not sure exactly how you want to handle this (through either server-side or client-side code), but I suppose that you could do that through a little bit of Javascript : 

    <script type='text/javascript'>
        //Number of list boxes on the client
        var listboxes = document.getElementsByTagName("SELECT").length;
    
        //Alert the number present
        alert("There are " + listboxes + " listboxes");
    </script>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, January 3, 2014 12:23 PM