6 Replies Latest reply on May 19, 2015 8:17 AM by weedonpaul

    Go to a related record in list view

    weedonpaul

      Title

      Go to a related record in list view

      Post

      Is it possible to go to a related record in list view

      I have a list of lines in list view, but each one has an edit button that I would like to open that record in form view, make changes and close the window, but it keeps going to the 1st record and not the one I'm looking at

      Help:-)

       

        • 1. Re: Go to a related record in list view
          philmodjunk

          GTRR should work just fine from list view. But you may not need GTRR at all. In list view, GO TO Layout can be all that you need to change from a list view layout to a form view layout based on the same table (Occurrence). But look out for OnLayoutExit triggers on the list view layout and onLayoutEnter, OnRecordLoad triggers on the Form View layout.

          If you take a second look and can't get it to work, feel free to describe your set up in more detail.

          • 2. Re: Go to a related record in list view
            weedonpaul

            Hi

            I change it to just Go To layout, but still no joy, I have attached pictures of layout, the script for the botton press and the two relevant pages from the layout details. on the layout Lines there is 1 script trigger "on layout enter sort records and go to the first record" but I press the button after that. on the layout lines edit, there is 1 script trigger to resize window.

             

            when I hit the edit button it opens the new window, but only ever show's the first record. I can scroll through to the correct record but I want to go straight to it.

             

            • 3. Re: Go to a related record in list view
              philmodjunk

              You show layout set up for one layout but don't explain which layout it is for and from your calculated layout name, you could have quite a few different layouts.

              Remember that script triggers can be tripped when you leave the current layout and when you enter the new one. And your New Window script step will also trigger them as well as OnRecordLoad.

              If any of those are performing scripts that change the current record, that could be why this fails.

              This is a case where the script debugger in FileMaker Advanced is invaluable. By enabling the debugger and clicking the edit button, you'd see exactly what, if any trigger performed scripts will pop up in the middle of your edit script and interfere.

              • 4. Re: Go to a related record in list view
                weedonpaul

                I do run the scripted debugger and nothing came up, I have attached the other layout that the edit button takes the user to.

                I have taken of the script trigger that sorts records and goes to the first record and it works now, But I don't understand it. I do want it to sort the records and go to the first on when I enter the layout "lines" but not when I open up a new window "lines edit"?

                • 5. Re: Go to a related record in list view
                  philmodjunk

                  I do run the scripted debugger and nothing came up,

                  I have taken of[f] the script trigger that sorts records and goes to the first record and it works now

                  Those two statements appear to contradict each other. This is exactly the type of script that I suspected was the source of your trouble as it has a step that goes to the first record. And it should have popped up in the debugger as you stepped through the script from what you report here. Perhaps you ran this test after you removed the script trigger.

                  Here's how you can keep a triggered script from doing anything when you don't want it to. Write it like this:

                  If [ Not $$TriggersOff ]
                     Put rest of script here
                  End IF

                  Then, in a script where you don't want a layout change or other action (such as New Window) to preform the triggered script:

                  Set Variable [$$TriggersOff ; value: True ]
                  Put any script steps that might trip a script trigger here, after the global variable has been set to True

                  Then, just before any point in your script where the script exits, put:

                  Set Variable [$$TriggersOff ; value: False ]

                  Normally, that just means that you make this last step the last step in your script, but sometimes there's an exit script or Halt script somewhere in your script and then you need to put a copy of this step just before it so that you don't leave script triggers disabled.

                  I try to remember to add the If [Not $$TriggersOff] code to every triggered script I create so that I can disable all triggers by setting or clearing this one single global variable.

                  Hmmm, don't suppose FMP 14 gave us a new option for this? (I'll have to check....)

                  • 6. Re: Go to a related record in list view
                    weedonpaul

                    Sorry, I have now learnt how to use the debugger tool and realise that it was opening the new window on the same layout and then switching the layout, so of course it was re sorting and going to the first record.

                    I like your idea of turning the script of with a global variable, I have now learn't something. I have set a variable of the record number when I start the script and go to that record at the the end of the script, which seams to work.

                    Thanks for patience.