2 Replies Latest reply on Oct 21, 2013 1:05 PM by RickyFarr

    Newbie needs help - a potential simple question



      Newbie needs help - a potential simple question


           Hi all!

           I am Sorry to ask this but I am having issues understanding something about a relational database and how to set it up...

           I have a table with clients which are automatically assigned a unique ID when the record is created. I need to then have a button create a new record in a different table labelled 'pet', which needs to be associated with that individual client.

           i am struggling how to do this... I know this may sound like a fundamental principle of how to set things up... But I am still in the newbie phase!

           Thanks for anyone's help in advance.


        • 1. Re: Newbie needs help - a potential simple question

               You may not need any button at all to do that. Whether you do or not, you'll need a relationship defined in Manage | Database | Relationships that looks like this:

               Clients----<Pets     (I'm guessing that a client may have more than one pet here)

               Clients::__pkClientID = Pets::_fkClientID

               For an explanation of the notation that I am using, see the first post of: Common Forum Relationship and Field Notations Explained

               Here's a method that does not need any such button:

               Double click the relationship line between Clients and Pets to open the Edit Relationship dialog. Click "allow creation of records via this relationship" on the Pets side of the relationship.

               Now, if you place a portal to Pets on the Clients layout, you can add new Pets records by entering data directly into the portal. FileMaker will update _fkClientID for you with the correct matching value to link it to the current record on your Clients layout.

               And if you still want that button, set it up to perform this script:

               Set Variable [$ClientID ; value: Clients::__pkClientID ]
               Go to Layout ["Pets" (Pets) ]
               New Record/Request
               Set Field [Pets::_fkClientID ; $ClientID ]
               Go to Layout [original layout ]

               If you want to stay on the Pets layout so that additional data can be entered, remove the last script step from this script.

          • 2. Re: Newbie needs help - a potential simple question

                 OMG... If I realised I would get a reply that fast I would have stayed in front of my desktop lol.

                 Thank you!

                 i have been watching a whole load of tutorials on YouTube, but none explained it that simply. I will try this method later.


                 thank you for your time... Very much appreciated.

                 kindest regards,