7 Replies Latest reply on Feb 25, 2010 4:20 PM by philmodjunk

    Passing value from one form to another.



      Passing value from one form to another.


      i have one table which i would like to have btn in to add another form to. so can i have a btn when pressed go to another form and then use the unique id of the last field into the new form?

        • 1. Re: Passing value from one form to another.

          Use a script that captures this value in a variable. Then, after switching layouts, the script can still refer to the variable in order to access the ID.


          Set Variable [$ID; Value: YourTable::YourIDField]

          Go To Layout[second layout]

          #do whatever you need with this layout, create a new record?, Perform a find?

          • 2. Re: Passing value from one form to another.

            Set Variable [$ID; Value: Roster::roster_id]

            Go To Layout[Boat]


            then i need


            Boat::boat_roster_id to = the new variable.


            How would i do this, is their a section on this site or other that i can read for refrence to see how to structure scripts?


            Thanks Phil

            • 3. Re: Passing value from one form to another.

              Set Field [Boat::boat_roster_id to ; $ID ]


              will store the contents of $ID into the boat_roster_id field of the current record in Boat. That could be dangerous unless you've written additional scripting to ensure that the correct record is current before you do this step.




              In this forum, you are in the right place for scripting questions. You can also learn more from filemaker tutorials and books on the subject if you wish.


              You might also want to read this thread for advice on posting to this forum section:


              When requesting assistance on this forum...

              • 4. Re: Passing value from one form to another.
                   would it be an issue if i had this script execute only when a btn was pressed?
                • 5. Re: Passing value from one form to another.

                  What do you mean by "an issue"?


                  If you switch layouts, you may be also switching tables (or at least switching table occurrences). If the two layouts refer to different tables, they'll have different current records and there's nothing in our script, so far, that enables filemaker to determine which record in the second layout is the correct record to modify with the set field instruction. Instead, it just modifies whichever record is "current". I don't know how you've set up your layouts--so I don't know if you will have a problem with this or not.


                  If both layouts refer to the same table occurrence, then they'll have the same current record and there will be no problem, but if both layouts have the same table occurrence, you don't need to switch layouts just to do this action in the first place.


                  Note: "Table Occurrences" are the "boxes" found in your relationship graph in Manage | Database | Relationships. There will be at least one for every Table you've defined in Manage | Database | Tables unless you delete one. In layout setup... you'll see a drop down menu labeled "Show records from". The names in this drop down list all the table occurrences that exist in Manage | Database | Relationships.

                  • 6. Re: Passing value from one form to another.

                    File Maker 10

                    Mac OSX 10.5.8


                    Ok, i have a table called roster and in it i have what is basicly all the contact information for a user. i have another table called boat, and i would like to beable to create as many boats as i want and associate them with a user. so in the table boat i have a colume called boat_roster_id where i tend to store the unique id of the user who owns the boat. So at the end of the user form i would like to have a btn to add a boat to the user and each boat has 10-15 fields.


                    Am i going about this the right way?

                    • 7. Re: Passing value from one form to another.

                      Are you creating a new boat record or updating an existing boat record?


                      You might want to look up "Portal" in the filemaker help section. If you use a portal to your Boats table, you might not need any scripting at all or the scripting needed might be very simple.