4 Replies Latest reply on Jan 15, 2015 1:28 AM by DanielPerry

    Noob Question - Go To Related Record Script



      Noob Question - Go To Related Record Script


      I'm teaching myself FMP as I go on this occasion. 

      I'm pretty sure I'm doing something really stupid here, but I have been banging my head off the wall for about 24hrs with this one.

      I have a layout portal, which creates records in a table. Basically adding delivery notes to a job ticket. I have an edit button on each line of the portal which uses a simple "go to related record" script to display that table/layout. While this button goes to the correct record, it will also display any other records also linked to the record containing the portal. Is there anyway to get it to only display the required record?


        • 1. Re: Noob Question - Go To Related Record Script

          go to related record will do that. There are a couple ways of doing what you want

          1. In your script, right after go to related record, you can do Show All Records, Omit Record, Show Omitted Only


          2. Create a global field in your parent table, create a new table occurrence of your child table and relate it to your parent table with global field = child primary key, then in your script above the go to related record add a Set Field step and set your global field to the primary key of the child record using the portal's table occurrence, then change your Go To Related Record script step to use the new table occurrence

          #1 is the quickest and easiest to implement, but will cause any On Record Load script triggers on your child layout to fire needlessly, so if you have those then don't use this

          #2 is the best from an execution stand-point but it requires you to add a field and a table occurrence which is slightly more difficult for you to have to maintain

          • 2. Re: Noob Question - Go To Related Record Script

            Amazing, thanks so much for your help. That one seemed to be a real stumbling block for me.

            • 3. Re: Noob Question - Go To Related Record Script

              The #1 one method, can, in rare cases, fail to isolate a single record if there are multiple users interacting with your database at the same time. If one user creates a new record at just the wrong fraction of a second in time, the Show Omitted Only step can bring back both the intended record and also the newly created record.

              This can be avoided if you use the records primary key (unique identifier) in a find to find just that one record instead of using Show All, Omit, Show Omitted...

              • 4. Re: Noob Question - Go To Related Record Script

                Thanks again Phil :)