4 Replies Latest reply on Dec 11, 2009 12:33 PM by jconner99

    Inserting to a field from another record

    jconner99

      Title

      Inserting to a field from another record

      Post

      I am trying to create a script that will automatically insert information from a record into a field of another record. In my database I have a table called projects with records that contain project information. Each record has a project number. I have another table that is related to the projects table. I want to create a button that will perform a script that will

      1. Go to the layout for the related table

      2. Insert the project number from the projects table to the related table

        • 1. Re: Inserting to a field from another record
          philmodjunk
            

          This can certainly be scripted but in most cases is not necessary.

           

          The script

           

          Set Variable [$ID; Value: Yourtable:: ProjectNumber]

          Go To Layout [Select layout for related table]

          New Record/Request

          Set Field [RelatedTable:: ProjectNumber; $ID]

          Go To Layout [Original layout]

           

          With the right relationship options and a portal, the above script will be unecessary as this process will hapen each time a person enters data in the bottom blank row of the portal to add a new related record.

          • 2. Re: Inserting to a field from another record
            jconner99
               Thank you for your help. Please excuse my ignorance as I am a novice at filemaker. I do have a portal in the layout for the project table from the related table. But I did not know you can add new records to the related table from the portal. How is that done? My portal doesn't have a bottom blank row.
            • 3. Re: Inserting to a field from another record
              philmodjunk
                

              Open manage | database | Relationships and find the two TableOccurrence boxes for your layout and portal. Double-click the line that links them. In the dialog that pops up click the check box labeled "Allow creation of records via this relationship" for the portal records. You may also want to click the Delete check box next to it. (with that option selected, deleting a record in your main table automatically deletes the related records in your portal which is usually what you would want to have happen.)

               

              Many folks get confused over the terms Table and Table Occurrence. To learn more, click the following link:

              Table vs. Table Occurrence (Tutorial)

              • 4. Re: Inserting to a field from another record
                jconner99
                   Your my hero. You don't know how much work you saved me. It works great!!!!!!!!!!!!!!!!