3 Replies Latest reply on Oct 21, 2015 3:37 AM by KenDeFilipps

    New Window not retaining found set

    KenDeFilipps

      I have a "new window" script step.  Per FMP documentation it is supposed to retain the found set of the original window, but it is not.

      The FMP documentation says:

      Description

      A new window has the same layout, same table, same found set, and same current record as the original window.

      Instead, the new window is opening, but is finding all records, thus eliminating my found set which I wish to work with in this new window.

      Now the reason for this is that on the main file I have an "on open" script trigger which includes a "find all records" script step.

      Is there a way to disable that "on open" script when a second iteration of a file is opened with the "new window" script step?

        • 1. Re: New Window not retaining found set
          erolst

          KenDeFilipps wrote:

          Per FMP documentation it is supposed to retain the found set of the original window, but it is not.

          The FMP documentation says:

          Description

          A new window has the same layout, same table, same found set, and same current record as the original window.

          Instead, the new window is opening, but is finding all records, thus eliminating my found set which I wish to work with in this new window.

          Now the reason for this is that on the main file I have an "on open" script trigger which includes a "find all records" script step.

          So, is the documentation wrong, incomplete, or buggy?

           

          You can add a $$var to your script triggers (or at least that one) and let them exit if that flag is set:

           

          If [ $$NOTRIGGER ]

            Set Variable [ $$NOTRIGGER ; "" ]

            Exit Script

          End If

          # [ original code … ]

           

          Then open the new window with a script

          Set Variable [ $$NOTRIGGER ; 1 ]

          New Window

          • 2. Re: New Window not retaining found set
            robwoof

            +1 for erolst's suggestion.

             

            There is something else to check: Is the script trigger "OnFirstWindowOpen", or is it "On WindowOpen"? It sounds like you want the "OnFirstWindowOpen", but the behaviour you describe is more like "OnWindowOpen".

            • 3. Re: New Window not retaining found set
              KenDeFilipps

              Sorry for the long delay in response.  I was basically misinterpreting what was happening.  The "onFirstWindowOpen" was working properly, but it was a script step that was revealing all records.

               

              In any event, I did find a solution using ValueCount(WindowNames).  Basically, if that count is less than 2, I open a new window.  If it is >2, I open a new window, but close the previous window to keep things tidy.

               

              Erolst's script did work, but I find the ValueCount is working as needed.