3 Replies Latest reply on Nov 25, 2013 10:38 PM by philmodjunk

    Unique ID based upon date



      Unique ID based upon date


           Hi there - I am a FM novice, but am learning and love the interface and will likely use it a lot for my current and future work.


           I am stuck in trying to create a unique ID based upon today's date. For example, I want the unique id to be DDMMYYXX - so today, the first entry would be 25111301 and the second would be 25111302, etc etc.  I thought I would use the "serial number" feature, but can't figure out how to get this done and thought the experience here would be able to help me easily.  Thanks for the advice and I apologize for my naiveté !



        • 1. Re: Unique ID based upon date

               Why do you need a unique ID in the Date field?  What is the purpose?

               There are other ways to create a unique id.. such as Get (UUID)

          • 2. Re: Unique ID based upon date

                 Perhaps have another Calculation field, based on the creation date and the Serial Number.

                 So you'd have 3 fields.

            SerialNumber =  Auto-generated Number on creation (i.e. 001)

            Date = Auto-generated Timestamp on creation (i.e. 25/11/2013 16:21:43)

            DateBasedID = GetAsNumber ( Day ( Date ) & Month ( Date ) & Year ( Date ) ) & SerialNumber (i.e. 25112013001)

                 However, like Jason, I can't think why you'd need to have this.

            • 3. Re: Unique ID based upon date

                   Often such "secret decoder ring" Id's are needed to support labeling uses outside the database (such as a label put on a shipping carton) or to support legacy systems clients are unwilling to abandon. Such uses can be supported by FileMaker , but please do not use such a value as a Primary key for linking the table to other tables in your database.

                   A self join relationship can be set up that matches by a date field and then Set Field can be used in a script for creating new records. The script can create a new record, a date field used in the relationship can auto-enter the creation date and then a Set Field step can assign the date based ID number:

                   New Record/Request
                   Set Field [YourTable::Sequence ; Max ( YourTable|SameDate::Sequence ) + 1 ]