4 Replies Latest reply on Aug 2, 2013 7:36 PM by user19036

    serial # for child table?


      A Table that is not in a Parent relationship with any other table - does it need a serial number field, or not?



        • 1. Re: serial # for child table?

          Always a good idea to put a serial number field in every table. You never know when you might need it in the future.

          • 2. Re: serial # for child table?

            Ageeing with David.  Every record in every table of a database needs a unique ID field - the Primary Key. The field takes up practically no space, so there is no reason not to include it. The standard way to do this has been to have Filemaker set this field as a Serial Number and set validation to Unique.  


            However, if you will be having mulitple copies of your database out there into which Users are inputting data on a non-shared basis - and you will be merging those copies together later into a master file - it is possible to get duplications in this field.  That is to say, there will be no duplications internal to any one copy, but there could be duplicates when merged. You really don't want that to happen.  If this is a concern, you might want to use the Get(UUID) function to assign the Primary Key field value.  This will put a Universally Unique ID in each field so there is no chance of duplication on merger of the individual copies.





            1 of 1 people found this helpful
            • 3. Re: serial # for child table?
              Stephen Huston

              David and Michael are correct, in terms of best practices. In fact, if you know that your record will never have its own child-record, the id really doesn't need a primary key of its own for relationship purposes, but having an id field can still be useful. You may have need down the road to capture a record ID in a script variable and use that for custom formatting the active record, testing record position within a looping script, or, as your needs change -- yep -- allowing the creation of previously unanticipated grandchildren records.


              If the ID is there, all of these are simple and the data exists ready to use. If it comes as an afterthought, you have to go back and add the field and populate the records for that field, and hope you remembered to protect things like your modification date field(s) so you didn't just hose your records.

              1 of 1 people found this helpful
              • 4. Re: serial # for child table?

                I very much appreciate all of your thoughts!

                I kinda had this one, but wanted to be sure there wasn't something I wasn't thinking of!!