2 Replies Latest reply on Jun 12, 2012 11:53 PM by tnfink

    Global fields get lost


      To centralize the constant values I use in my scripts, I created a table called "Constants" and added a global field called "EfficiencyFactor". I designed a layout to set the value of the EfficiencyFactor.


      With only myself as single-user enviroment, this worked well.


      With multiple users (acutally only 2) the value of the global field get regulary lost. The second user access the database via instant-web-publishing.


      The DDR confirmed that the only write access to the global field exists and it is performed by the layout.


      To check the date and responsible person for the change of EfficiencyFactor I added two other global fields "LastEditTimestamp", "LastEditAccount". A trigger updates theses two new fields after the EfficiencyFactor is changed in the layout text box. That worked too... in a single-user environment.


      In my multi-user-environment these two additional fields got also lost.


      I can pretty easily replay this situation by using a FilemakerPro client simultanously with an IPW-client (a.k.a. Web browser). I even can see that in one client the global field is set and in the other it is not.


      I now exchanged my global field with a global variable which is initialized after a new window is opened. This works.


      If anyone knows a better solution I would apreciate to hear it.

      If not then maybe this post can help other developers to avoid some headaches

        • 1. Re: Global fields get lost



          That's exactly how global fields work. They are only "global" to each individual user, and they will only retain values that are set when the solution is accessed in single-user mode.


          I think you'll find that there are many uses for global fields in multi-user solution. For example, they are great for selectable record filters.


          One way to implement "constant" fields is to define them as calculations, where the calculation itself is a constant value. One benefit of doing it this way is that the values are truly constant- there's absolutely no way that they can change without changing the definition of the field itself. A global variable can be changed by any script, so you don't have the same value security.

          • 2. Re: Global fields get lost

            thanks for the clarification. Now it starts to make sense. Instead of "global" it seems to be something which is in other communities called "session-local".


            Also thanks for the hint about the calculation. That seems to be the best way to define constants.