4 Replies Latest reply on Nov 9, 2011 11:10 PM by jaybeemob

    Global value retention with multiple users

    jaybeemob

      Title

      Global value retention with multiple users

      Your post

      I have been developing single-user FileMaker solutions for a while but I am now looking to employ one particular solution as a multi-user database. My question relates to the use of global fields.  I have some scripts that add data to a global field and then use that data later in the script. I am concerned that if one user activates the script, another user could also activate the same script from another record and modify the global field for the original user, with disastrous consequences. 

      Is there a ‘best practice’ approach to solving this problem? I assume that the use of variables would be one solution but I would welcome advice from the more experienced developers about how to ensure the database is robust in a multi-user environment.

      Many thanks

        • 1. Re: Global value retention with multiple users
          philmodjunk

          Global fields behave differently in shared databases.

          Each user's changes to the value of a global field is not visible to anyother user. When a user closes the file, the changes made by the user are not retained. FileMaker has been designed to work this way to prevent the very issue you are concerned about here. This does, at times, require some extra thought and effort when you need to change a value in a global field that other users need to then see when they open the file on their machine.

          • 2. Re: Global value retention with multiple users
            jaybeemob

            Many thanks for the very quick reply.  This does pose a further question though! If the global field values are different for different users, what is the best way to create a single global value for all users? For example, I have set up a global container field to hold the company logo for printing invoices.

             

            Thanks again for your assistance

            • 3. Re: Global value retention with multiple users
              philmodjunk

              If you put a value in a global field from the host machine (the machine that didn't access the db through open remote), the changes made to the value in the field are retained. For files hosted on FileMaker server, this requires opening the file with FileMaker Pro, editing the value and then closing and uploading the file to the server.

              If you use a schedule in FileMaker Server to run a script to modify values in global fields, this runs "from the host" and also makes lasting changes to the global field values. I often use this trick when I put an updated file up on the server and then discover that I left the wrong value in a global field while testing the updates.

              You can also store the value in a utility table in a non-global field and use a script to copy the value from this non-global field to the global field when the file first opens. You can then make a lasting change to the initial value of the global field by editing the value in the non-global field used to set the value.

              • 4. Re: Global value retention with multiple users
                jaybeemob

                Many thanks for explaining the position.