0 Replies Latest reply on May 26, 2011 11:01 AM by philmodjunk

    Calculation fields with Global Storage?

    philmodjunk

      Title

      Calculation fields with Global Storage?

      Post

      Ever since we upgraded to FileMaker 10 here at work, I've noticed that calcuation fields can be defined with Stored, unstored, or global storage. That global storage option intrigued me, but so far I can find very little use for a calculation field defined with global storage.

      I thought it might be a useful way to combine the values of more than one get or design function in a single expression so I could place it on any layout without needing a relationship, courtesy of the field's global storage. While I can place the field that way, I've found that, unlike an unstored calculation field, the value in the field fails to update automatically.

      I've experimented with global calculation fields that refer to local fields in the same table and the results I've gotten aren't terribly useful. Example:

      I defined a local number field as Const. I defined a global calculation field in the same table as gcConst with just Const as it's expression. I then went to browse mode and entered a number in Const. As expected the same number appears in gcConst, but then I'd get that result if I just typed a value into a global field directly. I then created several records in the table and tried entering different values into Const in the different records. Whatever record I most recently edited would update gcConst with that value. Predictable, but can't see that it's useful.

      I then hosted the file with FileMaker Pro on one machine and logged on to it as a guest from another. At this point, things got really strange. I could have just one record in my table. If I edited the value into Const on one machine, gcConst updated to show the new value on that machine, but not the other. If I then edited Const on the second machine that edited value appeared in gcConst on it but not the first machine.

      So far so good, but then I closed the file on the guest machine, edited the value of const on the host machine and then re-opened the file on the guest machine. I expected to see the newly entered value on the guest machine. Instead, it still displayed the value from the last time const was edited on the guest even though that value no longer existed.

      So far, that leaves me with only one very limited way to use a global calculation: I can define a constant value in it such as a value for PI or the current local sales tax rate and the value is now available to any layout or script in my system without needing a relationship to the table where I defined the field and the value will be retained even if I save a clone of the file. On the minus side, updating such a value requires developer access to the file to redefine the calculation where a start up script that loads the global from a value in a table does not have that limitation.

      Does anyone see any other use for a global calculation field?