Tips and Tricks!


It’s here that we give a little back and share some neat Tips & Tricks with our fellow FileMaker developers… This one comes from one of our Senior FileMaker developers ~ Malcolm Fitzgerald (Certified FileMaker13 developer)

Using Local Variables in Merge Variables
Did you know that you could use a local variable in merge variables? Well, you can, but they live and die so quickly that they can’t easily be displayed.

Using Merge Variables
Ever since FileMaker allowed us to put variables onto the layout with merge variables we’ve been using them to store and display low overhead, context-free, data that can be moved around as fast as your CPU can shuffle the bits. We always used global variables for this job and loved them, despite some drawbacks.

Layout Level Calculations
With the introduction of calculations at the layout level we got to start exploring ways of generating variables dynamically in the layout context. Many of these calculations provided the opportunity to evaluate state and populate global variables. In combination with conditional formatting it was possible to generate dynamic text on layouts. The thing was, these calculations were performed once when the object was loaded. Any local variable that was defined in the calculation disappeared.

Hide Object When
Now we have the Hide Object When calculation. This calculation controls visibility of layout objects and it is, so to speak, permanently active. We don’t know the exact mechanics of the layout evaluations but the most obvious effect is that any local variables that are defined in the Hide Object When calculation are also permanently active.

What this Means
No more name-space collisions.* No more clogging of the Data Viewer.

How we are using Local Merge Variables
We’re using them for intelligent, dynamic layouts. Layouts are becoming more intelligent and local merge variables are a part of that mix. Look at the example FMP14 file to see a simple way of handling multi-lingual text. This is the sort of job that was possible using global fields and calculation fields. Local Merge Variables do the job perfectly. The display of text labels in the user interface is handled by the layout level calculations, making a language change as simple as setting a user preference.

download media: LocalMergeVariables.fmp12

* local variables are protected by their scope.