1 Reply Latest reply on Nov 11, 2013 2:58 PM by taylorsharpe

    How can I use Go to Related Records script to go to a specific layout in an external file?

    websalesabc

      HI everyone. I have a FileMaker file that serves as a menu. It lists numerous external FileMaker files, which you can access via the menu. I keep these as seperate files as it makes updating and adding new ones much easier.

       

      For example, I have

       

      1. Menu.fmp12

       

      2. File 1.fmp12

       

      3. File 2.fmp12

       

      4. File 3.fmp12

       

      The 3 files display in the Menu via a portal as related records as I have linked them as external data sources etc.

       

      My curren solution.

       

      I can very effectively navigate from the Menu file to the desired layout in the external file with the Go to Related Record script step. The settings enables you to select an external datasourse and its specific layouts.

       

      My problem. This works very well if I and only if I use the Go to Related Records from a button and a Button Setup step. It does not work if I use the Go to Related Records script step as part of any other script.

       

      I want to enable users to go to the correct external file layout by clicking the related record in the related records portal. Then via a script, go to the correct external Related record layout. My script for this is:

       

      If[Selected File::fk_File ID = 1]

      Go to Related Record[From table: “External Table 1”; External; Using layout: “Enter File 1(Table 1)]

      Else If[Selected File::fk_File ID = 2]

      Go to Related Record[From table: “External Table 2”; External; Using layout: “Enter File 2(Table 2)]

      Else If[Selected File::fk_File ID = 3]

      Go to Related Record[From table: “External Table 3”; External; Using layout: “Enter File 3(Table 3)]

      End If

       

       

      Although the Go to Related Record script settings are exactly the same as when I associate it with a button step, it does not work.

       

      My solution: I used the above if logic to navigate to diffirent layouts, each sopecifically created for every external file. Here I place a button thet has the Go to Related Record step setup as part of the Button Setup. This takes me to the correct layout in the external file. But I do not want this extra window.

       

      Why is my Go to Related Records script only working from a Button Setup persepective and not as part of any other scripts?

       

      Please help

       

      Thanks Joh

        • 1. Re: How can I use Go to Related Records script to go to a specific layout in an external file?
          taylorsharpe

          I'm surprised it works directly in the user interface but not in script mode since that is not the paradigm that FileMaker scripting works on.  It may have to do with whether the other file is already opened.  When I need to do things in another file, I open that file and then tell the first file's script to run a script in the newly opened file instead of trying to put it in the first file.  It is weird to write a script to do things in a file that it is not in. 

           

          Of course, where possible, I try to combine files like these into a single file and you'll avoid that problem as well as many others such as security issues between different files. 

           

          If GTRR doesn't work, just manually do it.  Set a variable, go to the new file, enter find with the variable and you should have what you want.  While GTRR should work, I would not spend hours trying to figure out why when there is an easy work around.  That is unless this is more of for the principal of the situation and no one is paying for time on it.  But that is up to you.  If you have a sample of these files you could upload, I bet we could figure it out because GTRR should work. 

           

          Best of luck!

          1 of 1 people found this helpful