5 Replies Latest reply on Feb 8, 2013 11:20 AM by philmodjunk

    Run Script on Portal Record Selection

    donblaylock

      Title

      Run Script on Portal Record Selection

      Post


           I have a portal that loads a Reports table with an "X" relationship to my main table.

           I'd like to be able to click on a row in the table and have it run a script with parameters.  I tried Button Setup and a Script Trigger (OnObjectEnter & Save) and none of these are returning the correct informaiton from the currently selected record on the Reports Portal.  It's as if the script triggers are getting called before the row in the table is set.  I'm fairly new to FileMaker so detailed help would be greatly appreciated.

           Thanks in advance for any help.

      Screenshot_2_8_13_12_22_PM.png

        • 1. Re: Run Script on Portal Record Selection
          philmodjunk

               Button setup should work.

               You can select an object or all the objects in your portal row and use button setup to turn them into a button.

               Since it is not working, the best guess is that your script is losing the "focus" on the clicked portal row before it accesses the data in the portal row.

               Another possibility is the expression you are using to reference the data you want is not correctly set up to refer to fields in the portal's table occurrence.

          • 2. Re: Run Script on Portal Record Selection
            donblaylock

                 I have attached a couple screenshots of the watch window and the script debugger.  When I hit the call to "Go to Related Record" the data from Reports::LayoutName is correct.  When I hit the next line of code it cahnges to the first record on the table.

            • 3. Re: Run Script on Portal Record Selection
              philmodjunk

                   What is supposed to happen when this script is performed?

                   In layout mode, if you open Portal Setup..., is "Reports" the exact text shown in "Show Related Records From"?

                   What name appears in "Show Records From" in Layout Setup... for your layout?

              • 4. Re: Run Script on Portal Record Selection
                donblaylock

                                    What is supposed to happen when this script is performed?

                It calls another script and passes the Layout (Report) that is going to be shown.  In this case I am expecting it to simply Goto Layout "RigDirections"

                                    In layout mode, if you open Portal Setup..., is "Reports" the exact text shown in "Show Related Records From"? Yes

                                    What name appears in "Show Records From" in Layout Setup... for your layout? My Main Table, NobleSales.

                I have the two tables unrelated with the "X"

                      

                • 5. Re: Run Script on Portal Record Selection
                  philmodjunk

                       Ok, your first script step, Go To Related Records is not doing anything for you. It probably is losing the focus on the clicked portal row and that will cause the results you are reporting. Remove it.