There are a number of ways to extract data from another table without changing layouts if you use either a relationship, relationship w/filtered portal, or a calculation using ExecuteSQL() (if you have FileMaker 12 or newer).
To discuss those methods, I'd need to know what find criteria you are specifying inside Perform Find[Restore].
But you can also keep one script from performing triggered scripts when it changes layouts or does other actions that trip script triggers.
Rewrite the above script like this:
If [Not $$TriggersOff ]
Set Variable [$$TriggersOff ; value: True ]
Go to Layout [
Perform Find [Restore] ---> enter find mode does nothing in your script
Go to Layout
Set Variable [$$TriggersOff ; value: False ]
Exit script is also not needed in this script as your script will exit without that added step when the last script step executes.
Thank you. Worked perfectly.
FYI the find criteria ... the Parent layout contains customer satisfaction Surveys. The layout in the parent contains a portal showing all Issues that have been assigned to each Survey. Some surveys have none. I FIND all of the Surveys have at least one related record in the Issues table by entering * in the proper field in the portal. At the moment, 430 surveys have at least one issue but there are over 600 records in the Issues table because some Surveys have more than one issue. I store the found count in the variable $$SurveysWithIssues.
The Ranking of Issues layout is based on the child, "Issues" table. It ranks the Issues in descending order based on the count of each Issue in the Issues table. It also displays the percent each issue represents of the Surveys that have at least one issue. This is where the $$SurveysWithIssues variable is used.
So .. assume 430 Surveys have at least one issue and that there are 600 records in the Issues table and that 50 of the records in Issues table have "Reports" in the Issue field. The percentage shown in the Ranking of Issues layout for "Reports" is 50 / 430 (11.6%) not 50 / 600 (8.3%)
Put another way, 11.6% of the Surveys that had any issues at all mentioned Reports.
Thanks again for your help.