Alpha DevCon 2018
Results 1 to 12 of 12

Thread: Count Browser Rows?

  1. #1
    Member daverad1's Avatar
    Real Name
    Dave Keller
    Join Date
    Dec 2007
    Location
    Atlanta, GA
    Posts
    106

    Default Count Browser Rows?

    Dumb Question????

    How do I get a total number of rows in a browser query

  2. #2
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,299

    Default Re: Count Browser Rows?

    More details would help us answer your question.

    Are you working with a "browse" layout, or are you talking about an embedded browse inside a form?

    Are you talking about a single table?

    In the simplest case when you run a query against a "browse" layout the number of records that meet the selection criteria is displayed on the status line at bottom of your screen.

    If you are working with a script and need to "compute" the number of rows, the records_get() method for the <query> object pointer will return the number of records that meet the selection criteria.

  3. #3
    Member daverad1's Avatar
    Real Name
    Dave Keller
    Join Date
    Dec 2007
    Location
    Atlanta, GA
    Posts
    106

    Default Re: Count Browser Rows?

    Thanks Tom,

    I am hoping to avoid a second query to the database and would like simply a more visable record count on the form. It will match the result displayed at the very bottom of the screen. This is a browse layout.

    Thanks again for your help,
    Dave

  4. #4
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,190

    Default Re: Count Browser Rows?

    Quote Originally Posted by daverad1 View Post
    Dumb Question????

    How do I get a total number of rows in a browser query
    The number of the rows is the number of the records.Many ways to get the number of records, here is one:
    A5_GET_RECORDS_IN_QUERY()

  5. #5
    Member daverad1's Avatar
    Real Name
    Dave Keller
    Join Date
    Dec 2007
    Location
    Atlanta, GA
    Posts
    106

    Default Re: Count Browser Rows?

    Thanks G but wouldn't this involve running the browser query twice? I have different queries and would simply like to indicate total records in the browser window.

  6. #6
    Member daverad1's Avatar
    Real Name
    Dave Keller
    Join Date
    Dec 2007
    Location
    Atlanta, GA
    Posts
    106

    Default Re: Count Browser Rows?

    Now that I think about it, I just need to display the value that already exists at the bottom of the screen. Is this value listed by some reference name that I could place more visibly on the same form? I don’t want to keep hitting the database unless it is absolutely necessary.

  7. #7
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,190

    Default Re: Count Browser Rows?

    No it doesn't but after reading your latest post what you need is a calc field using dbcount()

  8. #8
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,299

    Default Re: Count Browser Rows?

    Dave, if this is not a form layout where are you going to display the count?

    And...

    How is the user going to run the query?

    More details please.

  9. #9
    Member daverad1's Avatar
    Real Name
    Dave Keller
    Join Date
    Dec 2007
    Location
    Atlanta, GA
    Posts
    106

    Default Re: Count Browser Rows?

    This is on a form (with a browser window as well) that will display the results of various queries. The record count at the bottom right of the screen is exactly what I need so if I could just grab or retrieve this exact value and display it in a Text box on this same form.

    I hope this helps.
    Thanks,
    Dave

  10. #10
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,299

    Default Re: Count Browser Rows?

    Dave, and is the form based on a single table?

  11. #11
    Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,787

    Default Re: Count Browser Rows?

    That value is in a var named {Total_Records}. But you cannot place just anywhere on the grid. You can place it in a column, repeating with each row, which is usless. Or you can place it in a couple places within the grid, but NOT in any of the freeform areas above, below, etc.

    And the var {Total_Records} is not available on the A5W page, it only exists within the grid.

    One thing you can do if you really dont want to run the query twice, is move your filter from the Grid Query area directly to the A5W page. You can populate dbf.filter=your query and it will run as if typed in the Query area. But now that I think of it, it wont return the count, so you have to run it twice anyway.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  12. #12
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,299

    Default Re: Count Browser Rows?

    Assuming this is a desktop app (since that's the forum we're all in) the following will give you the current count, in a form based on a single table:

    Code:
    parentform.index_pointer().records_get()

Similar Threads

  1. Licensed user count and network users count
    By Rokrz in forum Alpha Four Versions 7 and 8
    Replies: 0
    Last Post: 05-17-2007, 10:49 AM
  2. record count - delete button adjusting count
    By dik_coleman in forum Alpha Five Version 7
    Replies: 3
    Last Post: 12-23-2005, 11:06 AM
  3. ROWS
    By Joe De Rocker in forum Alpha Five Version 6
    Replies: 2
    Last Post: 11-07-2004, 05:41 AM
  4. Count rows in a browse
    By tlyon in forum Alpha Five Version 4
    Replies: 10
    Last Post: 11-24-2001, 09:46 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •