2 Replies Latest reply on Jul 7, 2009 6:44 AM by wdockery

    Copy a single field's contents into a field in another table

    wdockery

      Title

      Copy a single field's contents into a field in another table

      Post

      Hello, I am a newbie using FileMaker Pro 10, and I have two tables in a single file called "Contact Management".  Each table contains demographic information about individuals.  One table is called "Contact Management" and has public info such as address and phone number; for this I just use "Contact Management", one of the FileMaker templates; the only thing I've added is a serial number field called "ContactID". 

       

      The other table has more private (medical) info and is called "Patient Info" and is only pertinent to a small subset of the records in "Contact Management"; it includes a serial number field called "PatientID". 

       

      I would like to have the following workflow during data entry:  Create a new record in "Contact Management".  After entering address and phone, I would like to be able to switch (with a button) to "Patient Info" and have "ContactID" automatically entered into the "PatientID" field.  This way the records will be related through the ID field.

       

      I can't figure out how to do this!  I would like the solution to be compatible with the web viewer.  I have been playing around with "Insert from last visited" script and "getfield", "Set field", and "Set variable"; but I just don't know enough to make it work.

       

      Thanks if you have advice on this!

        • 1. Re: Copy a single field's contents into a field in another table
          LaRetta_1
            

          wdockery wrote:

          Create a new record in "Contact Management".  After entering address and phone, I would like to be able to switch (with a button) to "Patient Info" and have "ContactID" automatically entered into the "PatientID" field.  This way the records will be related through the ID field.


           The button would say "Add Patient Information" and then would run script similar to:

           

          Set Variable [ $ContactID ; Contact Management::ContactID ]

          Go To Layout [ Patients table occurrence ; Patients Data Entry layout ]

          New Record Request

          Set Field [ PatientID ; $ContactID ]

          Commit Records/Requests

          Go To Field [  ... first field you want to enter patient information on ... ]

           

          But I would suggest that you have an auto-enter serial number in Patients called PatientID and have another field called ContactID and set THAT field with the ContactID variable and not the PatientID.  Every table should have a unique auto-enter ID field named the same as its table.  It can also be confusing later that you consider a PatientID and ContactID same. 


          • 2. Re: Copy a single field's contents into a field in another table
            wdockery
              

            Thanks for your advice; script works great.  I tried the set variable and set field steps but I must have had the syntax wrong.  And I had not used the "Commit" command before; not sure whether that might have contributed to the problem.

             

            And I appreciate the database design tip with regard to a serialized ID named after the table, and I will implement that going forward.