1 Reply Latest reply on Jan 30, 2014 7:38 AM by mikebeargie

    Advice on backing up database in P2P environment

    beaconny

      Environment: Running in a Mac environment only. Using FM 12 and FM 13. FM application is a based on the separation model. The user accesses the Interface (one file) which gets its data from the Data file (a second file). I need to only backup the Data file. The Interface and Data files will be placed in a directory (not shared) on a local computer on the network. The backup will be placed in a separate directory (shared) on the same computer.

       

      I understand that the Data file must be closed before it is backed up.

       

      I found the following script on the FM Help site. You are instructed to attach this script under File Options > Script Triggers > OnLastWindowClose.

       

      Set Field [<table name>::Count Field; <table name>::Count Field + 1]

      If [<table name>::Count Field > 4]

      Save a copy as ["Backup Copy.fmp12"; copy]

      Set Field [<table name>::Count Field; 0]

      End if

       

      Question 1: When the Interface file is closed, is the Data file (used by the Interface) also automatically closed? Does FM also then consider both of these files closed? In other words, if the script is triggered OnLastWindowClose, will both files really already be closed when the script is performed?

       

      If the answer to question 1 is No, then suggestions are welcome.

       

      Question 2: This concerns closing the application file on the host computer. Since the host should not close the application while there are still users remotely connected, how can I check, through a script, to make sure that all users are disconnected?

       

      To phrase this differently, how can I count the number of users who have opened the application remotely and have not closed the application? There was, until FM ver 6, a function get(UserCount), but it is gone. Hopefully there is something better than calling each person on the phone.

       

      I have been getting great advice from this site. Hoping my luck holds out. Thanks for any help.

        • 1. Re: Advice on backing up database in P2P environment
          mikebeargie

          There is something better, it's called FileMaker Server, which gracefully handles filemaker backups without any manual process or cobbled together solutions. If your data is important, then it should be worth the investment to purchase server edition.

           

          Question 1 - OnLastWindowClose is file specific, and takes place when the last open window of that specific file closes. So closing the interface file will not also close the data file.

           

          script triggers process BEFORE the action that triggered them (in most cases). So if you use exit script result = false in OnLastWindowClose, it will block the window from closing. Otherwise the script evaluates BEFORE the last window closes.

           

          Get(UserCount) is still a function, I am not sure who told you it was gone, but I just checked the FM13 documentation and it's there.