6 Replies Latest reply on Jul 18, 2011 2:56 PM by philmodjunk

    Creating unique number



      Creating unique number



      First time posting !!

      Am I  correct in assuming that GetAsNumber (timestamp_create ) will always yield a unique number of 11 digits?

      I am using Filemaker Pro 11


        • 1. Re: Creating unique number

          No, expecially in a multi-user system.

          Think about creation of two records in the same second.

          Use the normal auto-enter serial number ( you could even start from 10000000000 )

          • 2. Re: Creating unique number


            My concern with an auto-enter serial number is that over time it will grow. After ten years it could be huge.  This is a number that, on very rare occasion, users might have to type by hand. Also, I want to know it can fit in a field/space of a pre-determined size.  

            If two people try to create a new file at the exact same second (I am in a small office of 15 people) I suppose that they will just get a validation alert and then when they try again it should work.

            I know this isn't perfect, but it seems to be the most reliable way I have found so far.


            • 3. Re: Creating unique number

              Serial numbers in FileMaker can become very large without exceeding the capabilities of the system. It will have the same size limitation as a timestamp field so you are not gaining any support for larger values by using such a field.

              If this field is to be used as your primary key, then "This is a number that, on very rare occasion, users might have to type by hand." Should never, ever be the case. Use only internally generated values of no additional "meaning" for primary keys. You can always add other fields that do have additional meaning to your table where they can be used to perform finds and as a sort field--just don't use it in a relationship.

              • 4. Re: Creating unique number

                There are several free custom functions that will create a unique number, usually be combining a timestamp with the record id (internal from FMP) and the machine NIC number. Check out BrianDunning.com search for UUID. They are quite handy for creating unique primary keys in multi user environments where later syncing of data is necessary.

                • 5. Re: Creating unique number


                  No, this field is not my primary key and is not being used for a relationship - I have another field for that.

                  I guess the main question I have is will a timestamp field displayed as a number grow over time in the number of digits?  How is it generated?

                  I need a unique number that will not exceed a certain number of digits.  If I grab the last 3 digits of the users IP address and add that to the timestamp that should take care of the problem of a same second record creation.

                  Thanks for the Brian Dunning tip, I will check it out.

                  • 6. Re: Creating unique number

                    Timestamps record a number that records the date and time elapsed since an arbitrary start date and time. Thus, under the hood, it's just another number field just like your serial number field.