2 Replies Latest reply on Mar 13, 2012 6:19 AM by nielsprins

    Chek for net connection

    nielsprins

      Hi

       

      I have a sollution with data on a Filemaker Server Adv. and the user interface on the local computer.

       

      I want to check for net connection to the server and close the solution if no connection exits.

      In my startup script I opening a small database file on the server. If the script can open that file, it continues to open the whole solution, otherwise it close down.

       

      My problem is that FileMaker is opening the datafiles in "Manage > External Data Sources" before it runs the startup script.

      When it don't find the files it gives an error followed by a "Open Missing File" dialog.

      Any way I can override this behavior?

       

      I have thought of a opener file , but I would like to have only the interface file and nothing more...

       

      Thanks in advance for any suggestions.

       

      Niels

        • 1. Re: Chek for net connection
          katherinerussell

          Hi Niels,

           

          If there are table occurrences on the graph of your interface on the local computer, FileMaker will typically try to open the referenced files when it opens - before the OnOpen script runs, as you have noticed.

           

          To avoid the "Open Missing File" dialog, I'm afraid you'll need to test for the availability of the hosted file by using a file on the end-user's computer other than your main interface file. This "test for host" file should have a file reference to the hosted file(s), but no table occurrences pointing to tables in the hosted files.

           

          To confirm that a hosted file is available, you can use the Open File [ YourHostedFile ] script step in an OnFileOpen script, and then test for Get(LastError). If the hosted file is available, Get(LastError) will be zero, and the script should open the file on the local computer. If the hosted file is not available, Get(LastError) will return a non-zero value (100 for "File is missing" or 802 for "Unable to open file"), and the script can display a custom dialog or text on a layout informing the user that the hosted file is unavailable.

           

          An opener file, even if you it's not your first choice for other reasons, can perform this task - and you can configure the system so that users don't deal directly with more than one file.

           

          I hope this helps.

           

          Kind regards,

           

          Katherine

          --

          Katherine Russell

          Senior Consultant, NightWing Enterprises

          FileMaker Certified Developer (7, 8, 9, 10 and 11)

          Speaker, FileMaker Developer Conference, USA, 2007, 2009 and 2010

          • 2. Re: Chek for net connection
            nielsprins

            Hi

             

            Thanks. I hoped that I could avoid the extra opner file, but if it can't be done, it can't be done.....

             

            Maybe something for Filemaker to consider. How to run a script before anything else.

             

            Regards

             

            Niels