6 Replies Latest reply on Aug 21, 2011 11:24 PM by MonikaJost

    script

    MonikaJost

      Title

      script

      Post

      I want to create a new record in another table and import automatically the student id from first table using a button. student record table has student ID field. clicking on button will open Registration table, create new record and has student ID automatically filled with number.

        • 1. Re: script
          LaRetta_1

          Script would look something like this (pseudo) example:

          Being on the Student record, click button 'New Registration' ...

          New Registration script:

          Set Variable [ $studentID ; Students::StudentID ]
          Go To Layout [ Registration layout based upon Registrations table ]
          New Record/Request
          Set Field [ Registrations::StudentID ; $studentID ]
          Go To Field [ field you want User to begin typing in ]

          • 2. Re: script
            MonikaJost

            thank you so much.

            How to I ge:t Set Field [ Registrations::StudentID ; $studentID ]

             

            I edit script

            click on Set Field

            select StudentID in Registration

            and then? how to I select my variables $studentID?

            Mahalo from Hawai‘i

            • 3. Re: script
              LaRetta_1

              Notice that the first line of the script writes the StudentID of the student record you are on, into a variable by using the Set Variable[] script step while on your Student record.  Then when you go to Registrations, you set the Registrations StudentID with the variable.

              You specify the variable right within the calculation - just type $studentID.  Make sure that what you type matches the variable name you created in the Set Variable[] step. So it would be:

              Set Field [ Registrations::StudentID ; $studentID ] ... just typing the red portion in the calculation dialog.

              • 4. Re: script
                MonikaJost

                thanks firgued it works. GREAT. worked about 10 hours on this.

                any idea how I can have more then one field show up.

                like first name, last name, ID, address?

                thanks again.

                m

                • 5. Re: script
                  LaRetta_1

                  Take only the ID with you through your script.  Once the relationship has been established (inserting StudentID into Registration record) then ALL of the student’s information is immediately available to use how you wish.

                  You can cross-place any Student’s fields (such as name) directly on your Registrations layout … just insert your Student field onto Registrations.  Or you can set your Registrations field(s) to Auto-Enter Lookup or Auto-Enter Calculation to permanently insert into Registrations.  You can read up on them in FM Help (search for Auto-Enter and Lookup).

                  When would you cross-place related fields and when would you insert the data?  If you cross-place fields, Registration display of Student data will update if the Student record changes.  This is usually fine for things such as Name, email, DOB.  But you may want to insert the address at the time of the registration (using auto-enter or lookup) so next year, you have a record of the Student’s address at the time of last year's Registration even if they moved since then.  These are business decisions which only you can make on each of these fields.  :^)

                  • 6. Re: script
                    MonikaJost

                    IT FINALLY WORKED.

                    THANK YOU SO VERY MUCH.

                    monika