9 Replies Latest reply on Aug 28, 2013 10:37 AM by philmodjunk

    Return to found set



      Return to found set


           I have a number of reports where I constrain the found set, then the report is printed and then I return to the original layout. Is there a way to return to the original found set (the found set prior to the constraint) after printing?

        • 1. Re: Return to found set

               Option 1: Open a new window, constrain the found set and print. Close the window and you will be back at your original found set.

               Option 2: Define the report layout to use a different table occurrence of the same table. Perform a find or use Go to Related records to produce the desired subset of records on this layout. SInce it uses a different table occurrence, its found set will be independent of the found set on your original table and you can then simply return to the original layout to find your found set is unchanged.

          • 2. Re: Return to found set

                 I tried option 1 and get a strange result. The script seems to be stuck in a loop, opening window after window. To stop it, I hit escape. Then I have to close dozens of windows. Once, I tried not hitting escape and the program crashed. Attached is a screenshot of my script.

            • 3. Re: Return to found set

                   Is the script performed via a script trigger? Could the script be tripping its own trigger?

                   And the two steps after "close window" appear unecessary if you goal is to get right back to where you started.

              • 4. Re: Return to found set

                     Upon entering the report layout the script is triggered. If I place a button on the form layout to open a new window, then I select the report (minus the window command), then everything works fine.

                • 5. Re: Return to found set

                       Yes, that is one way to keep the script from tripping its own script trigger and that seems like a reasonable approach in this case.

                       Another way to keep a script from tripping script triggers is to use a global variable as a "switch" that disables trigger performed scripts when set to a value.

                       Enclose each trigger performed script in an If block:

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

                       Then set $$TriggersOff to True near the start of the script you want to run without tripping script triggers and set it back to False at the end of your script or just before any points in the script where you have exit or halt script steps.

                  • 6. Re: Return to found set

                         Sorry, but I do not quite understand. Here is what I tried.

                    • 7. Re: Return to found set

                           The New window step should also be inside the If block not above it. Like wise the close window step should come before End If.

                           You want every step of your script except possibly some comment steps, to be inside that IF block.

                      • 8. Re: Return to found set

                             Still looping. See attached.

                        • 9. Re: Return to found set

                               Then the script shown isn't the only factor here. FileMaker Advanced pays for itself very quickly in these situations as you can enable the script debugger then perform the script so that you can watch things work one script step at a time. If some other script is being performed by a script trigger tripped by this script, that script will pop up in your debugger.