7 Replies Latest reply on Oct 25, 2012 2:10 PM by philmodjunk

    Trouble with relationships



      Trouble with relationships


           So I have been spending the last few days trying to figure out relationships and the proper way to use them.   I THINK I am making some progress, but I'm not sure.  It still is not woking, however.  I included a couple screenshots so maybe you guys can offer some assistance.  


           Thanks in advance!


           EDIT: Here is another screen to help out.  I am trying to select a value from a value-list (populated by a field in a table) and go to a new layout that displays information about that particular show.  I really appreciate any suggestions.  


        • 2. Re: Trouble with relationships

               Thanks for the link, but I unfortunately still have FMP 11 so I am unable to open the fmp12 file.  I am only able to open fmp7 files.  Any suggestions?

          • 3. Re: Trouble with relationships

                 Use Field Option in Manage | Database | Fields to give DesiredShowName global storage.

                 Format the field with a drop down list of the show names from the Shows::ShowName field.

                 Select the auto-complete option for your value list to make it more userfriendly.

                 Perform this script to Find the show selected from the drop down:

                 Go To Layout [//specify the layout you want to use to display the found show, must be based on Shows table]
                 Enter Find Mode [] ---> clear the pause check box
                 Set Field [Shows::ShowName ; Shows::DesiredShowName ]---> This step will not work unless DesiredShowName has global storage specified for it.
                 Set Error Capture [on]
                 Perform Find[]

                 Your Go button can perform this script, or you can use an OnObjectSave script trigger to perform this script each time automatically each time a user selects a show from the drop down.

            • 4. Re: Trouble with relationships

                   Thank you!  I got it to work a couple times but it suddenly stopped.  I have no idea why... I did not change anything.  It performs the script, but is not populating the fields with the related record in from the shows table.  


                   I checked the relationships, and everything appears to be fine.  It isn't making sense to me.  What information can I provide to help with troubleshooting? Thanks again!

              • 5. Re: Trouble with relationships

                     First, open Manage Database Fields and make sure that ShowName and DesiredShowName are still both of type Text.

                     Then there are two tests you can do:


                     Remove or disable the Set Error Capture [on] Script step.

                     This step keeps an error dialog from interrupting the script if no records are found. By running this script and getting the error message, you might get a clue as to why the expected records are not being found.


                     Immediately after trying this and getting no records, select "modify Find" from the records menu. This will return you to find mode with the criteria from the latest find--the one performed by your script--still present in the specified fields. This will allow you to see what data is actually being used to find records.


                • 6. Re: Trouble with relationships

                       Thank you.  I was able to solve the problem.  One of the fields was not a "number" type anymore.  I have one more question. After selecting a different show from the desiredShow dropdown, shouldn't the rest of the fields on that layout auto-populate?  I tried using the same basic script you suggested before, but to no avail.

                  • 7. Re: Trouble with relationships

                         The script, as written, finds a specific record and displays it on a layout that you specify. That layout should be able to display all the data from the record that you found simply by including those fields on the layout.

                         If you want to select a show from a value list and see other fields on the same layout as your value list now display data from that show, or records linked to that show record, then you need a different value list and layout design.

                         See this thread for two distinctly different ways to "auto-populate" fields on a layout. Which is the best option for you depends on what you want to do with this data: Auto Fill