4 Replies Latest reply on Dec 21, 2009 10:13 AM by TSGal

    Related table not show records properly

    dev696

      Title

      Related table not show records properly

      Post

      Hi

      A primary key in a table is foreign key in other three tables. Fields of these three tables are added in primary key table's layout with in tab options each tab contain one of three tables feilds its means, 3 tabs for each 3 tables fields. These 3 tables fields are also exist in their own layout.

      So the problem is that when i duplicate any current record its only duplicate those fields that exist in primary key table and the rest of three tables fields are not duplicated in the layout of primary key's table.


       

      waiting for quick and positive response...

       

      thanks

        • 1. Re: Related table not show records properly
          ninja
            

          Howdy dev696,

           

          It sounds like it's working properly...just not doing what you want it to do.

           

          When you reside on your primary table and say "Duplicate Record", it duplicates the record you are viewing...not all of the related ones.

           

          If you want to duplicate all three related tables' records also...i'd have to ask "Why?".  What is it that you are trying to accomplish?  Duplicating related records in a total of four tables means that you now have to update four different keys.

           

          Next question: If you want to duplicate the related tables' records, this seems to hint that you have a primary table with one-to-one relationships with three other tables.  If it is always this way, why not just have one table?  And if there are multiple related records in the three related tables...do you want to duplicate ALL of the related records?

           

          Could you describe what you are trying to do, what would the end result be?  (and hint at why you're doing it...this would also help).

           

          Thanks for the feedback.

          • 2. Re: Related table not show records properly
            philmodjunk
              

            "So the problem is that when i duplicate any current record its only duplicate those fields that exist in primary key table and the rest of three tables fields are not duplicated in the layout of primary key's table."

            That's exactly how filemaker is designed to work. If you want the related records to also be duplicated, you'll need to find those records in their respective tables and duplicate them as well. If you don't want the related records duplicated, then you'll need to change the design of the relationship linking your tables. I suspect that your primary key field is an auto-entered serial number which automatically produces a new different number when you duplicate your record and this "breaks" the link to your related records.

             

            Having to duplicate records like this is often a sign that a different approach to managing your data is needed. What are you attempting to accomplish with this duplication? What do the fields in the related tables represent?

            • 3. Re: Related table not show records properly
              dev696
                

              Hi

               

              Actually i had created staff performance appraisal system. In that system i have lot of questions and i can divided these questions in three main category and created three tables for each one and in last table i entered date, person name etc and Record_ID as a primary key that is foreign key in rest of three tables and design layout in that way that all three related tables fields are added in three tab options and this tab option exist on primary key table's layout. 

              So when i entered data the primary key automatically copied in related tables and rest of data i entered manually by using same layout.

               

              Now most of the time i will need same old record with very few changes so when i duplicate any old selected record then only primary tables fields are duplicated those are outside of the tab option.

               

              Please mention this task is possible without writting addition new script or if not then please explain script steps.

              • 4. Re: Related table not show records properly
                TSGal

                dev696:

                 

                Thank you for your posts.

                 

                When you duplicate a record, and your Primary Key is set to Auto-Enter information, then the Primary Key will update to the new value.  To add records to the related libraries with the same key field, create the following script:

                 

                Set Variable [ $key ; <Primary Key field> ]

                Go to Layout [ <layout with first related table information> ]

                New Record/Request

                Set Field [ <Foreign Key field> ; $key ]

                 

                Go to Layout [ <layout with second related table information> ]

                New Record/Request

                Set Field [ <Foreign Key field> ; $key ]

                Go to Layout [ <layout with third related table information> ]

                New Record/Request

                Set Field [ <Foreign Key field> ; $key ]

                Go to Layout [ <original layout where Primary Key exists> ]

                 

                That is, after duplicating the record, we want to grab the Primary key and store it in a variable ($key).  We then switch to the layout of the first related table, add a record and replace the foreign key field with the variable $key.  We do the same for the other two related tables, and when finished, return to the original layout.

                 

                If you need clarification for any of the above steps, please let me know. 

                 

                TSGal
                FileMaker, Inc.