3 Replies Latest reply on Sep 21, 2012 2:47 AM by bagheraa

    Copy of a database file



      Copy of a database file



           is it possible to make a copy of a database file from a script in another database? And is it possible also to fill the fields of the new database with values of the current database?

           I will explain. I have a propietary database, and a small template database for exportation purposes that I want to send to the client (the same as a report, but in a FileMaker file).

           The process then can be:

           1. copy the template file to the exportation file.

           2. fill the exportation file with data from the propietary db.

           I've been taking a look on the script commands that manage files, but i have not found yet the way to do this from a script. Have you any suggestions?



        • 1. Re: Copy of a database file

               There are three free plugins that may help.  Do not know which to recommend.




               Sharing your experience with testing and results would be nice.

               You will have multiple clients, not just one, the Report database would have to be uniquely named?
               The Template is a small subset of your Database, and has been setup for recurring imports?

          • 2. Re: Copy of a database file

                 Insert the template file into a container field in your main database. You can then create a copy of the template file any time you need to with ExportField Contents, and this can be scripted.

                 The next part can be tricky, but with care, it is possible to do:

                 Perform a find or finds in your main database to produce a found set of the records you want exported to your template database. Do this once for each such table of data where you want to export it to your template. Then use Perform script to perform a script in the template file (You have to make sure the external data source reference correctly points to the newly created copy of your template file, this is the tricky part.) that imports records from your proprietary file.

                 It will be simplest to set up the external data references from main file to template copy and from template copy back to the main file if you use relative paths which refer to the current location of your main database file. If you need to place this template copy in a specific location such as on the desktop, you can move the template file to such a location after the data import by inserting it into yet another container field and export field contents can then export it to the specified location.

            • 3. Re: Copy of a database file

                   Thank you very much for your answers, DavidAnders and PhilModJunk.

                   I will try first the tricky way proposed by PhilModJunk, as the only function I need from the plugins is to duplicate the template file.

                   The Report exported db must be named uniquely, as it must contain the date of the exportation in the name, and the Template db is independent of the main db, and must be copied and filled with several subsets of records of several tables of the main db.

                   Then the client will fill the Report db with his new data, and this new data must be then passed to the main db.

                   I will report the results.