Alpha Video Training
Results 1 to 16 of 16

Thread: Why is there a wrong record count?

  1. #1
    Member
    Real Name
    Michael Klein
    Join Date
    Sep 2003
    Posts
    250

    Default Why is there a wrong record count?

    Can someone please explain the following?

    After Emptying a table, clicking on File > Database Information shows the number of records as 1 instead of 0. I've seen Clipper report 1/0 when entering a record into an empty table, but shouldn't Alpha5 report this as 0?

    Thanks.
    --Michael

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

    Default RE: Why is there a wrong record count?

    Michael,

    I don't recall checking this before. Do you get the same value after packing the table?

    -- tom

  3. #3
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default RE: Why is there a wrong record count?

    I just created a new table with one field, saved it and went to db info, it too shows 1 record. I do not think this has anything to do with you 'emptying the table'.

    When I opened my new table in browse, it opens with a cursor in place for a record to be input. This is obviously the record that the info is reading.

    Cheryl

  4. #4
    Member
    Real Name
    Michael Klein
    Join Date
    Sep 2003
    Posts
    250

    Default RE: Why is there a wrong record count?

    Tom,

    Yes, the number of records still shows as 1 even after packing.

    --Michael

  5. #5
    Member
    Real Name
    Michael Klein
    Join Date
    Sep 2003
    Posts
    250

    Default RE: Why is there a wrong record count?

    Cheryl,

    The record you're referring to doesn't exist yet. It only exists in the record buffer until it's somehow saved/flushed to disk at which point it becomes record no. 1. It's very inconsistent for the record count to be 1 for an empty file. Reminds me of Reaganomics :).

    --Michael

  6. #6
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default RE: Why is there a wrong record count?

    LMAO ... can't recall the last time I heard Reaganomics

    If you think about it, the file itself really is not empty. The record does exist, it just does not have any 'data' in it.

    Cheryl

  7. #7
    Member
    Real Name
    Michael Klein
    Join Date
    Sep 2003
    Posts
    250

    Default RE: Why is there a wrong record count?

    Here's another wrinkle...

    When using table.records_get() from the Interactive window, the number of records returned is 0 as expected.

    --Michael

  8. #8
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default RE: Why is there a wrong record count?

    The record actually does exist. The buffer is where the data is placed and then moved to the actual record itself:

    When a table is open, there is always one record that can be called the current record. This record is the record upon which the next set of field operations will be applied. A temporary record buffer holds the data from the current record. When a record is entered or changed, the new data values are entered through this buffer.

    Internally, the physical location of the current record is referenced through the current record pointer. Every instance of an open table has its own record pointer. If the same table is opened twice (with two different object pointers), there will be two independently controlled record pointers.

    As Alpha Five processes a table, it moves from one record to the next, advancing the current record pointer. Each time the current record is changed, the field values for the new current record are retrieved, or fetched, from the table file. This process of moving the record pointer and retrieving the current record is known as fetching through the table.


  9. #9
    Member
    Real Name
    Michael Klein
    Join Date
    Sep 2003
    Posts
    250

    Default RE: Why is there a wrong record count?

    Take a look at your file with a Hex editor. The Table Header Record Structure of the FoxPro 2.x file used by Alpha5, along with the standard .dbf file structure, contains the Number of records in file in Byte offsets 4 - 7. The files I'm looking at all have 00 00 00 00 in that offset range indicating 0 records.

    --Michael

  10. #10
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default RE: Why is there a wrong record count?

    Hi Michael,

    I am not disputing your input here, I was just trying to show why I believe you are getting the results you are based on Alpha's Documentation. The database information is looking at the pointer. Maybe this should not be the case, maybe there is another way for Alpha to retrieve the record information in this help section.

    Cheryl

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

    Default RE: Why is there a wrong record count?

    Michael,

    Does the count rise to 2 when a single record is entered?

    -- tom

  12. #12
    Member
    Real Name
    Michael Klein
    Join Date
    Sep 2003
    Posts
    250

    Default RE: Why is there a wrong record count?

    Tom,

    The count remains at 1 after entering a single record.

    --Michael

  13. #13
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default RE: Why is there a wrong record count?

    Hi Tom,

    Yes the record count increases to 2 when you add a record. If you highlight the table from the database information screen and click on view records, it brings up the default browse and shows my first record with data and a spot to add a new record, but it is not showing the blank record.

    This feature is obviously pulling the record count from the pointer/buffer and not the actual record count.

    Michael, I actually do agree with your thought process on this issue. I do not know if this can be changed or not, there may be other reasons it was setup this way that we are not aware of. Only the powers that be, Selwyn/Richard whomever, can answer that question.

    If it can be changed and enough A5 users comment their opinions to this thread, then maybe it will be changed :)

    Cheryl

  14. #14
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default RE: Why is there a wrong record count?

    LOL, and mine changed to a count of 2 ... but only showed 1 record.

  15. #15
    Alpha Software Employee Selwyn Rabins's Avatar
    Real Name
    Selwyn Rabins
    Join Date
    Mar 2000
    Location
    Boston, MA
    Posts
    5,306

    Default RE: Why is there a wrong record count?

    this is a bug. it has just been fixed in V6.

  16. #16
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default RE: Why is there a wrong record count?

    Proof that once again the powers that be pay attention. Thank you Selwyn.

Similar Threads

  1. Memo fields - saving to wrong record
    By Steve Wood in forum Alpha Five Version 6
    Replies: 12
    Last Post: 07-25-2005, 05:51 PM
  2. Add record count to Tables/Sets
    By Melvin Davidson in forum Archived Wishlist
    Replies: 6
    Last Post: 05-18-2005, 12:09 PM
  3. Index on form record count
    By chadg@epix.net in forum Alpha Five Version 5
    Replies: 3
    Last Post: 01-04-2005, 05:10 PM
  4. query and count record
    By ken tjia in forum Alpha Five Version 4
    Replies: 0
    Last Post: 01-22-2004, 09:24 AM
  5. Getting a record count
    By Steve Sawyer in forum Alpha Five Version 5
    Replies: 7
    Last Post: 07-23-2003, 12:08 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
  •