3 Replies Latest reply on Mar 24, 2009 8:11 AM by philmodjunk

    Archiving Records



      Archiving Records


      Can anyone point me in the right direction?  I am looking for a plugin, script example, tutorial, etc that will help me to work with the records in my database.  Specifically, I am looking to archive certain records that are "Closed"  I need to know how to append to the archived table, etc.


      Also, when I create a runtime for one of my users, I need to learn how I can apply a patch to the program without disrupting the database they have.  I need some education on this sort of thing.


      Its probably basic stuff but I am still a bit new.  Thank you.

        • 1. Re: Archiving Records

          Here's how I do it.


          I put my archived records in a separate file. We did it this way originally, because at the time, every table had it's own file. We still keep this file separate, because Filemaker's most powerful tool for moving large blocks of data around, Import Records, is still set up only to work between different files.


          In a script we:


          Perform a find that pulls all the records to be archived into a single found set.

          Perform an external script located in the Archive File that uses Import Records to copy the data from the found set of your source file into the archive file. (Make sure to use the Matching Field option.)

          Confirm that the records are present in the archive. (there are many different ways to do this.)

          Delete them from the original file.


          Given that FMP now supports much larger file sizes and FM Server has much better options for making backups, I might not even use an archive today. Instead I might just keep the records in the original table and design my interface to hide the records from the user unless they specifically request a view of their "closed" records.


          For patching run time updates,


          Design an update script to


          1) Import records from the original version

          2) update any serial number settings to be greater than the largest serial number(s) present in the user's records


          The user would need to change the name of their existing file, (unless you supply a non FMP utility or batch file to do it for them) and would then run the script.


          Make sure you place your update script in your run time solution BEFORE distributing it to any users.

          • 2. Re: Archiving Records



            When importing records, is there a proper way to import when you have related records in 5 different tables?  In my app, I have a master table containing all the data for an application for a government program.  The other tables tied to this contain information on the spouse of the applicant, their income and assets.  These are spread across 5 or more tables.  If I distribute a patch or updated version of my app, I would want all of the data ported over to the new app by some automated script.


            Do you have to go to each table and perform an import?  Or is there some method or procedure to import into one table and have the related tables updated as well?


             Thanks for your insight and help.

            • 3. Re: Archiving Records

              "When importing records, is there a proper way to import when you have related records in 5 different tables? "


              Import records copies records from one table in your source file to one table in your target (archive in your case) file. If you are moving data from/to multiple tables, then you will need to perform a separate import step in your script for each pair of tables.


              A loose outline of your script would look like this:


              set up the desired found set of records in table1.

              Perform the table1 import script in the Archive file to copy the found records from table1(source file) to table2(archive file).

              Process your table1 found set as needed. (delete them, mark them as "archived", whatever).


              Set up the desired found set of records in table2.

              Perform the table2 import script in your archive file to copy the found records from table2(source file) to table2(archive file).

              Process your table 2 found set...


              continue for each table you from which you need to archive data.


              Thus, you will have one archive script in your source file and a separate archive script for each table in your archive file.


              Make sense?