Alpha Video Training
Results 1 to 17 of 17

Thread: Faulty Autoincrement

  1. #1
    Dr Alok Modi MD
    Guest

    Default Faulty Autoincrement

    I have a problem, for which I am not finding any solution. I have parent table which has vital data of patients with first field as "patient ID" which I have set to have default value of "0001" and other 5 tables which are child ones with 1-1 relationship and they are all linked to the parent table via "patient ID".
    Now when i open the form based on this set or the default browse, the ID enters itself as 0001, the moment I tab to the next field, the ID becomes, 000.

    Where am I go wrong? I've checked and rechecked the field rules and can't seem to find the answer.
    Sincerely,
    Dr Alok Modi MD

  2. #2
    "Certified" Alphaholic
    Real Name
    Cal Locklin
    Join Date
    Mar 2000
    Location
    S.E. Michigan
    Posts
    5,763

    Default RE: Faulty Autoincrement

    My guess is that you need to take a look at your existing records. It may be that your current records go from "001" to "999" and the auto-increment is limited because the next value after "999" is "000" when dealing with auto-increment fields.

    Remember that the default value for an auto-inc. field is only used to set the value for first record when starting from an empty table. After that it uses the existing data.

    You may need to run a global update to all some leading zeroes to existing data.
    ID = padl(ID,5,"0")

    Cal Locklin
    www.aimsdc.net

  3. #3
    "Certified" Alphaholic
    Real Name
    William Hanigsberg
    Join Date
    Apr 2000
    Location
    Toronto, ON
    Posts
    4,018

    Default RE: Faulty Autoincrement

    does it happen when you use the default form? Have you defined a field rule for the child tables or only for the parent (which is what you should have done)?

    Bill

  4. #4
    "Certified" Alphaholic
    Real Name
    Cal Locklin
    Join Date
    Mar 2000
    Location
    S.E. Michigan
    Posts
    5,763

    Default RE: Faulty Autoincrement

    Oops! "to all some leading..." should have been "to add some leading..."

  5. #5
    "Certified" Alphaholic
    Real Name
    William Hanigsberg
    Join Date
    Apr 2000
    Location
    Toronto, ON
    Posts
    4,018

    Default RE: Faulty Autoincrement

    I like Cal's hypothesis.
    Bill

  6. #6
    Dr Alok Modi MD
    Guest

    Default RE: Faulty Autoincrement

    Yes it happens on the default form also and also on the default browse. And Cal, at present I have not entered any data so far,it is an application that I have to use for entering data yet. I have yet to make labels and reports, but I am stuck here. And I have filled up these field rules for both child and parent tables.

    Dr Alok Modi MD

  7. #7
    Ryan Giggs
    Guest

    Default RE: Faulty Autoincrement

    Doc,

    Please make sure that your character size (width) for the Patient_ID is set to "4" if you want to use "0001" as you auto-increment value.

    Alternatively, you can also check to see (on your form) the properties on the field object of the "patient_id" if in the "Display" tab the display format as the correct "width" set (in your case it would be "4").

  8. #8
    Dr Alok Modi MD
    Guest

    Default RE: Faulty Autoincrement

    Nope same problem. The display tab is set to 6 now, it was set to 4 previously. I have a sinking feeling that I will have to redesign the whole thing from scratch.
    Dr Alok Modi MD

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

    Default RE: Faulty Autoincrement

    I suggest you enter at least one patient record using your custom data entry form. Then check the same record using the default form for the primary table in your set of tables.

    Tell us what you see on both the custom data entry form and on the default form.

    -- tom

  10. #10
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,644

    Default RE: Faulty Autoincrement

    Dr

    Cal has it right. This problem has come up a few times before.

    The value of 000 says that the highest value in the field is 999. The increment option adds 1 to the highest value in the field rather than the last value entered.

    The usual fix is to right justify the data in the field.
    I'd add an alltrim to the formula that Cal suggested.

    In this case 5 is the size of the field. Adjust as needed for the actual size of our field.

    padl(alltrim(ID),5,"0")


    If you are still having problems, post a copy of the talbe so we can take a look at it.

  11. #11
    Former Alpha Employee JerryBrightbill's Avatar
    Real Name
    Jerry Brightbill
    Join Date
    Apr 2000
    Posts
    5,173

    Default RE: Faulty Autoincrement

    You may want to check out this thread.

    http://msgboard.alphasoftware.com/alphaphorum/read.php3?sortby=lastreply&direction=desc&num=11&id=59382&thread=59344#MSG59405

    Actually, this was a bug in the A5V6 beta, but has not been confirmed in A5V5.

    Jerry

  12. #12
    Dr Alok Modi MD
    Guest

    Default RE: Faulty Autoincrement

    I give up. Nothing works. Not even the padl and alltrim functions. Its 2.34 AM here in India and I am all wooly. Just returned from the hospital. I guess either its upload my database or back to the design board. I have gone through Dr Wayne's solution on the thread posted, it did not work for me. I feel it is a bug in A5. It always is 0000 in the first record and 0001 and so on in the second records and so on.In the default from, browse and my created colorful form also.And I have not entered any data s yet. How can I when I have not completed my application? so It can't be that A5 is switching over to 0000 after the 9999 records.

    Yawwwwn!!!
    See u guys tomorrow.
    Dr Alok Modi MD

  13. #13
    Former Alpha Employee JerryBrightbill's Avatar
    Real Name
    Jerry Brightbill
    Join Date
    Apr 2000
    Posts
    5,173

    Default RE: Faulty Autoincrement

    Dr

    When you get up, restore the attached database and see if the set "vitals_link" works. There are currently no records in either table and no forms. Open the default form for the set or the default browse for the parent table "vitals". In both cases, autoincrement works correctly for me.

    One of the keys is that an autoincrement field should be set to skip as it should not be a field a user can enter. Also, you must set the default value in field rules at the start of entry, or you will see the results you are seeing where the field appears to go to "0000". When the record is saved in that condition, the correct initial value should enter, but it looks very odd when you are entering.

    If this doesn't work, then there is something indeed odd.

    Jerry

  14. #14
    Dr Alok Modi MD
    Guest

    Default RE: Faulty Autoincrement

    Hi Jerry
    Firstly let me tell you that alpha five is a wonderful software because it is "run" by people like all of you sweet souls on this message board, who take the time, initiative and pains to help lost souls like us. Yes I ran your sample application and it works fine. So there is no bug on my version, but somewhere my design is faulty. So let me try and see if I can correct that.
    Will get back to you.
    Regards
    Dr Alok Modi MD

  15. #15
    "Certified" Alphaholic
    Real Name
    Cal Locklin
    Join Date
    Mar 2000
    Location
    S.E. Michigan
    Posts
    5,763

    Default RE: Faulty Autoincrement

    Found his problem. The field width on the parent table was set at 3. This may have been a typo because the child tables were set at 4.

  16. #16
    Former Alpha Employee JerryBrightbill's Avatar
    Real Name
    Jerry Brightbill
    Join Date
    Apr 2000
    Posts
    5,173

    Default RE: Faulty Autoincrement

    Sometimes it is the simple stuff that trips us up - all of us.

    Jerry

  17. #17
    Dr Alok Modi MD
    Guest

    Default RE: Faulty Autoincrement

    Ya guys my problem was solved. I corrected the table structure and increased the width as Cal had suggested. Such a stupid mistake on my part but such nightmarish problem.

    Thanks all of u for helping me out.

    Dr Alok Modi MD

Similar Threads

  1. autoincrement field
    By dcorcoran in forum Alpha Five Version 6
    Replies: 9
    Last Post: 05-01-2005, 10:18 AM
  2. Help, I've got the autoincrement blues
    By michaelklein in forum Alpha Five Version 5
    Replies: 6
    Last Post: 03-03-2004, 07:46 PM
  3. Autoincrement child in set
    By Pat Bremkamp in forum Alpha Five Version 5
    Replies: 3
    Last Post: 01-08-2004, 09:57 AM
  4. autoincrement
    By Ludwig Beil in forum Alpha Five Version 5
    Replies: 2
    Last Post: 11-04-2002, 08:56 AM
  5. Autoincrement in a set
    By russ Boehle in forum Alpha Five Version 4
    Replies: 18
    Last Post: 01-23-2001, 05:01 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
  •