2 Replies Latest reply on Aug 17, 2010 10:08 AM by med

    adding record to a related table



      adding record to a related table


      I have a student table related to another table which has extended information for the student. Not all students have extended information. I have a layout based on the student table and I need to write a script to append a new record in the extention table whenever I click a button. The new record/request script step does not allow me to specify which table to add to. How can I do this?

        • 1. Re: adding record to a related table

          To specify a table, you first have to go to a layout that specifies a Table Occurrence in "show records from" in that Layout's Layout Setup... dialog.

          Here's an outline of the script:

          Freeze Window
          Set Variable [$StudentID ; Value: Students::StudentID ]
          Go To Layout [StudentDetails (StudentDetails)]
          New Record/Request
          Set Field [StudentDetails::StudentID ; $StudentID]
          Go To Layout [Original Layout]

          Note that this script will always create a related record when you click its button. If you want to strictly limit your system to just one such related record, you might want to add code that first checks for to see if such a record exists before creating a new one.

          • 2. Re: adding record to a related table

            Thank you that works