Merge variables and conditional formatting instead of calculation fields

There are times when you need to display data on a layout but don’t really need or want to define a new field in your FileMaker database. With the new merge variable in FileMaker 11, you can use conditional formatting, a let statement, and a merge variable to reduce the number of fields with calculations in your tables.

This technique is very simple to implement and has one caveat.  If data is changed in the database, the variable will not change without a window refresh.

The example file merge_variable_example.fp7 shows one parent with many children. The merge variable displays a list of children.

Technique:

1.  Place an object in the header part

2.  Define conditional formatting for that object using a let statement that defines either a local or global variable. The advantage of using a local variable is that it is gone once you leave the layout.

3.  Insert the merge variable onto the layout in any part below the header.

You do have the option to place both the object being conditionally formatted and the merge variable in the same part but you must understand how filemaker evaluates and draws a record when it is loaded.  Please see my blog post here for more information.

Pros and Cons of this technique:

Pro:

  1. Less scripts and script triggers in your solution
  2. You can have “narrower” tables which improves filemaker client / server performance. If you have a layout with even just one field, the data from every field is sent to the FileMaker client.
  3. Benefit to developers using separation model.

Con:

  1. If data changes, you will not see it until a screen refresh.

If you have found this technique helpful or have any tips or suggestions to make it better, please leave a comment.

Download the example file merge_variable_example.fp7

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.