This question is about how to best transfer the control of script execution from one FMP file to another.
Here is the situation:
A user of a database (FMP12) is able to enter different types of information, all of which is tagged (by the user) with master data.
The master data is a set of hierarchies (7 of them), and these are made available to the user on the data entry layouts through pop-up menus.
The master data is integral to almost every aspect of data entry, calculation and reporting.
There are some business applications for the database that would demand different master data hierarchies.
A database with a different business focus would become a separate application (ie off on its own fork).
But it would be nice to start with a clone of the 'parent' database. This is because the master data in the new business application will similar, but not identical to its parent.
That means it is much easier to edit an existing set of master data hierarchies than re-enter them from scratch.
Cloning the database is something that an admin would do. It needs to be simple and foolproof.
Ideally the admin would navigate to their restricted layout in the parent database, and press a button to activate the 'cloning' process.
However, the parent database has both master data and user data, and clone must only have the master data (ie the user data must be removed).
The largest fraction of data in the database is user data, with ~50mb of user data over ~100k records. Master data accounts for ~500 simple records over a couple of tables.
So the 2 questions are:
1 Is it better to create an empty clone and then import the master data or save as compacted and then remove the user data?
2 To make the process simple, control has to pass from one file to another. What is the best way to do this?
With respect to Q1, this 'forking' process might occurr a few times, say 10. And the data in one database will be completely independent of the data in another database.
With respect to Q2, suppose you choose to duplicate the database, and then remove the user data and then modify the master data to the new business application.
The duplication and removal of user data should be completely automatic. Modifying the master data in the new database is a manual process.
In this scenario, the admin would start a script in the 'parent', but then the control must pass to a script in the saved copy which would remove the user data.
Ideally the admin would not even get to select the new file's name, as it would be created on the fly with a timestamp to avoid any file system collisions.
Filemaker allows for scripts to be run in other files. But I cannot see how to do this if the name of the file copy is in a variable.
Oh, and a final note, this database does not run a separation model.
Any thoughts are much appreciated.