Alpha Video Training
Results 1 to 16 of 16

Thread: auto-increment

  1. #1
    Member
    Real Name
    John Cunradi
    Join Date
    Aug 2000
    Posts
    463

    Default auto-increment

    Using A5V10.5, I have a simple table that has a character field that should auto-increment.

    The record won't Save no matter what I've tried.

    I've also tried making it a user-enter field with a default of increment_value(previous("L2_Id"))
    This also gives me the result I wish but I still can't save the record.

    If I make the field a standard user-entered field without any defaults or auto-increments, it saves fine.

    It will also save correctly if data is entered through a form but not a browse or embedded browse...my preferred method for entering data into this table.

    Any ideas how to make this work ?

    Thanks

  2. #2
    "Certified" Alphaholic Keith Hubert's Avatar
    Real Name
    Keith Hubert
    Join Date
    Jul 2000
    Location
    London, UK
    Posts
    6,930

    Default Re: auto-increment

    John,

    A sample of your table would help a lot more to giving you an answer.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

  3. #3
    Member
    Real Name
    John Cunradi
    Join Date
    Aug 2000
    Posts
    463

    Default Re: auto-increment

    Vyperra_Processing.zip

    This is just the problem table, not the whole database.

    Thanks.

  4. #4
    "Certified" Alphaholic Keith Hubert's Avatar
    Real Name
    Keith Hubert
    Join Date
    Jul 2000
    Location
    London, UK
    Posts
    6,930

    Default Re: auto-increment

    John,
    embedded browse...my preferred method for entering data into this table
    It may be your preferred method but is not the best advised method.

    I'm looking at your form, but not sure exactly what I need to see or do.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

  5. #5
    Member
    Real Name
    John Cunradi
    Join Date
    Aug 2000
    Posts
    463

    Default Re: auto-increment

    Open form: L2_Standard
    Try to enter a new record.
    The correct value for the Identification will appear and all the other field work as expected.
    Next, try to save that record. It will disappear from the table and not be added.

  6. #6
    Member
    Real Name
    John Cunradi
    Join Date
    Aug 2000
    Posts
    463

    Default Re: auto-increment

    Sorry, L2-Standard is the embedded browse in the form Locator-2
    Either one of those will illustrate my point
    The other browses and form all work that way too.

  7. #7
    "Certified" Alphaholic Keith Hubert's Avatar
    Real Name
    Keith Hubert
    Join Date
    Jul 2000
    Location
    London, UK
    Posts
    6,930

    Default Re: auto-increment

    Hi John,

    I'm totally confused by the logic you are trying to use in field rules. eg, one field you have as default value and Lookup to another table.

    I suggest you strip out all your field rules and start with a simple auto increment with the simple default value "ABC" and go from there.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

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

    Default Re: auto-increment

    John,

    I think it's the previous values field rule that's misbehaving. Strip all of them out. Leave the auto_increment rule in place.

  9. #9
    Member
    Real Name
    John Cunradi
    Join Date
    Aug 2000
    Posts
    463

    Default Re: auto-increment

    Tried that, no luck. Any auto-increment or increment value() or anything using previous value as the default causes it.
    I even tried pulling the the previous value for a different field..same thing.

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

    Default Re: auto-increment

    John,

    I submitted a formal bug report, and Selwyn responded within just a few minutes. Turns out the browse has a feature that I didn't know about and I've been using them for years and years. Here's his response:

    thanks

    i don't think it is a mystery at all. it is intentional and it is an important feature and it is most definitely not a bug.

    the new row is not dirty, therefore a5 does not save the record. a5 only saves a new record in a browse if the user makes the row dirty. this has always been the case, and it always will be the case.
    otherwise, the user would end up with lots of unwanted new record if they simply clicked in the new record row.

    if you typed some value in any field on the new row, the record would save because it would then be dirty.
    For others reading this thread:

    John's table included field rules that auto-populated all the fields in each new record. This was done using an auto-increment rule, and a series of default values field rules. The effect was that as soon as a new record began all the cells in the new record row of the browse control were populated by rule. If you then do nothing else except try to save the row the row disappears. Without input from the keyboard the record was not "dirty", so its discarded.
    Last edited by Tom Cone Jr; 04-12-2013 at 04:38 PM.

  11. #11
    Member
    Real Name
    John Cunradi
    Join Date
    Aug 2000
    Posts
    463

    Default Re: auto-increment

    Thanks Tom for checking into that for me. I noticed that too but I wanted something where the user could just hold down the ENTER key and have it fill up the table to the point they wanted to stop.

    I suppose I could make some sort of Macro to do the data entry.

    Thanks

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

    Default Re: auto-increment

    Yes, a short script could be written to enter an arbitrary number of duplicate records, with different auto-inc field values. If you need help with that holler.

    -- tom

  13. #13
    Member
    Real Name
    John Cunradi
    Join Date
    Aug 2000
    Posts
    463

    Default Re: auto-increment

    I just tried it with an XBasic Change Record but I get the same issue.

    I'm going to call it a day and hit it fresh tomorrow

  14. #14
    Member
    Real Name
    John P.
    Join Date
    Nov 2010
    Location
    Boston, MA
    Posts
    321

    Default Re: auto-increment

    I have the same issue with fields that auto-populate based on previous values and increment if a certain statement is true. Like others said, if the user does not "dirty" the record then it is not saved. Is there a way around this?

  15. #15
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: auto-increment

    You might try <OBJECT>.SET_DIRTY() with the appropriate object name but I'm not sure which event you would need to use.
    There can be only one.

  16. #16
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    5,986

    Default Re: auto-increment

    it became such a nusance for me on one app, I made a small script to enter the ne record by a button to the table.
    Code:
    'there is a lookup or 2 before this to get some stuff into variables
    if vargetclientid = "" then 
    	ui_msg_box("missing","client id is missing",UI_STOP_SYMBOL+UI_OK)
    else
    dim bill as p
    dim fil as c = alltrim(var->vargetclientid) + alltrim(var->varthetype)
    bill = table.open("billtoclient",FILE_RW_SHARED)
    bill.index_primary_put("Clienttype")
    bill.fetch_find(fil)
    thecost = bill.clientcost
    bill.close()
    
    dim tbl1 as P
    tbl1 = table.open("inspections",FILE_RW_SHARED)
    tbl1.enter_begin()
    
    tbl1.type = var->varthetype
    tbl1.id_num = var->vargetid_num
    tbl1.clientid = var->vargetclientid
    tbl1.file_num = var->vargetfile_num
    tbl1.gs_pr = var->thecost
    
    tbl1.enter_end()
    tbl1.close()
    end if
    ' this will all vary depending on your use
    Dave Mason
    dave@aldaweb.com

    Skype is dave.mason46

Similar Threads

  1. Auto-increment
    By Peeter Gruner in forum Alpha Five Version 5
    Replies: 18
    Last Post: 03-31-2005, 01:28 PM
  2. Auto increment help
    By Bill Clementz in forum Alpha Five Version 5
    Replies: 4
    Last Post: 03-17-2005, 01:54 PM
  3. auto increment
    By Cheryl Lemire in forum Alpha Five Version 5
    Replies: 31
    Last Post: 08-10-2004, 08:48 AM
  4. Auto Auto-Increment Field
    By Ken McEntee in forum Alpha Five Version 5
    Replies: 8
    Last Post: 05-12-2004, 12:12 PM
  5. auto increment (AGAIN)
    By Rose Smith in forum Alpha Five Version 4
    Replies: 16
    Last Post: 06-11-2001, 12:56 PM

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
  •