2 Replies Latest reply on Dec 4, 2012 10:19 PM by SamuelHall

    Delete a Filemaker File from within...



      Delete a Filemaker File from within...



           So I know this is a little odd but I was wondering if anyone has tackled this before, I am attempting to delete the filemaker file from within it, as part of a script which will take you back to a main FMP File.

           Essentially what I am dealing with is a database which handles current HR information and can be manipulated to see how individual changes will affect the Budget of the company as a whole, what my manager would like is a way to create multiple copies of the database which can then be edited differently and compared (this part is done) then from within those files he wants to be able to delete them as they are discarded.

           I had considered just using duplication of all positional data with an instance variable but he would like to be able to send the databases individually so there needs to be separation of the old and new datasets.

           Currently I am considering saving the Files on creation to a temporary folder and then having a script for moving it to a permanent folder if desired, however this is an opt-in option where I would prefer an opt-out.

           Any Ideas would be nice, at the moment we are not running any plugins, FMP 11 v4.


           Sam Hall

        • 1. Re: Delete a Filemaker File from within...

               A file cannot delete itself.

               But FileMaker can delete other files--such as other FileMaker files--provided the following requirements can be met:

               The file must be in a location where the user's permissions allow them to delete the file

               The file must be closed.

               The filepath to that file must be known.

               If all of that is met, you can use Export Field Contents, with the path, but no field specified, to delete the file.

               But your design seems very cumbersome. Instead of having multiple files, I suggest having multiple record sets in the same file, in the same tables. Then deleting unwanted copies of this data becomes the simple process of deleting records instead of files.

          • 2. Re: Delete a Filemaker File from within...

                 Thanks Phil,

                 I agree it is cumbersome but it is how the boss wants the system set up, the original database contains sensitive information while the exports all contain only a snapshot of the data allowing the forecasts to be used in public meetings and sent to particular members of staff without having to worry about permissions for particular sets of data.

                 Did as you suggested and it works a treat, script holds a variable of the filename, opens the main database and from there it deletes the file at the variable path.