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.
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.
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.
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.
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
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.
Sorry, but I do not quite understand. Here is what I tried.
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.
Still looping. See attached.
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.