Try creating a new table that will have just one record, which include all the "globals" from last closed file. On start up, that new table single record is your global values.
Create one record per global and loop thru them.
Thank you for the suggestions!
I hoped it could be done with one record and two global fields. I'd like to enter all the $$variable names I want to retain (or delete them when I don't want them anymore) in one global field -- one $$variable name per line -- and have the other global field for my shutdown script to write each of those variables' values on corresponding lines. I don't know if this is technically possible. It doesn't look like there's a way to assign a variable name in scripts other than with the "set variable" step, and it doesn't seem to have an option to "get" a variable name. So I probably can't set a variable's name to the value of line x of field 1 and then set that variable's value to line x of field 2.
I may need to drop this idea and move on to more productive work on my file.
Thank you again.
$$Name is just one way to make a global variable. Before FMP added them to their program we did what i suggested and the names were constant. Many used names like gName to represent a global variable. With my suggestion, using gName shows in your list for easy of scripting versus $$Name. And for lists check out the functions that make working Lists easy.
If this database is not hosted over a network--you just have a single file option, you can use global fields instead of global variables and your data is automatically stored. If your database is hosted over a network, use Jim's method. Many hosted databases use a script set to run when the file is opened by a client that copies the saved values from such a table into the global fields.
You can then set up a script that runs when the file is closed to copy the global field values back to this table, but keep in mind that with multiple users, the last user to save overwrites previous values unless you take additional steps to preserve a different set of values in this table for each user.