Auto Increment Option Request

Viewing 3 reply threads
  • Author
    Posts
  • April 28, 2015 at 4:36 AM #13494

    Jimmy Uptain
    Participant

    Is there any way to have the auto increment apply a truly unique “serial number”?
    Sort of like the “Date Created” field, where once populated, it cannot be changed.
    I have to create unique invoice numbers and have found that some are duplicated. I understand how it happened and have taken steps in order to prevent it from happening again. But with more than one user, well, you know what can happen :)

    April 28, 2015 at 11:12 AM #13498

    Brendan
    Keymaster

    Hi Jimmy,

    There is one drawback with using the auto-increment field and that’s with sync. Because if you have two different devices both adding records, the last value generated is stored on the field object itself on each device. Imagine you both started at 1, even with your data synced, and then you added records, and they added records, you would get 2, they would get 2, even for different records. When you have multiple devices all adding at the same time, you’ll get duplicate values because there’s no central service for the next sequence number to be retrieved from.

    To have a truly unique serial number, I would have to have a server sitting out there on the Internet somewhere listening for requests for these serial numbers. And then what if you’re both offline at the time? It gets pretty tricky.

    So that’s why I don’t have a truly unique serial number. I mean, the only other way to do that is to generate a globally unique ID which is a huge string of random characters. That’s what Tap Forms uses for record IDs, photo file names, etc.

    Thanks,

    Brendan

    April 28, 2015 at 12:42 PM #13500

    Jimmy Uptain
    Participant

    I understand Brendon.
    Thanks so much for responding.
    I thought of a workaround on my end but found that it wasn’t an option either.
    I was gonna use the Creation Date as a serial or invoice number, as this number is pretty much unchangeable on the user level. However in order for it to be more “polished”
    I would’ve had the date in this format: 1504281432 or YYMMDDHHMM
    I figured with a date format such as this, it would be all but impossible for me to duplicate an invoice number.

    April 28, 2015 at 9:23 PM #13501

    Phillip Howe
    Participant

    How about adding a user ID in there that any new records for a specific user comes from a specific range.
    Example 3 users
    User 1 100 – 199 range
    User 2 200 – 299 range
    user 3 300 – 399 range

    Because the more users that “chance” of creating records at the exact Date and Time might be small but has the potential to have duplicates very once in a while.

    Adding the user New record range wound allow for multiple users to add unique records at the same given date and time.

    201504281050101 –
    201504281050201 –
    201504281051102 –
    201504281051301 –

    If you expect users to create more than 100 records in one day then increase the range to 1000.

    Just my 2 cents. :-)

Viewing 3 reply threads

You must be logged in to reply to this topic.