The Support Group Blog

Discover a Few FileMaker Tips and Tricks

Discover a Few FileMaker Tips and Tricks

One remarkable thing about working in a supportive and dynamic collective like the FileMaker developer community is that we can share our experiences and techniques. With Claris FileMaker, there are often many solutions to any given problem, and over time our community has come up with some innovative and creative ways to use FileMaker. Unfortunately, these things are usually not found in the standard documentation, but developers share them among themselves. Here are three compelling tips and techniques that we discovered recently. 

Sorting Columns

Users often want, and consequently, ask developers to provide the ability to sort columns in the list view by clicking on the column's label. Unfortunately, this can be tedious, and most solutions tend to pass a parameter indicating which field to sort by followed by a long list of IF statements: If $fieldName = “First Name”, sort by First Name, etc. Another solution we've seen is creating separate scripts for each column, which can clutter our script workspace. 

However, FileMaker offers a script step called “Sort Records By Field.” This script will sort the records by the field we specify or the currently active field. So instead of having a long list of IF statements, we only need two steps.

FileMaker-tips-and-tricks-1

The essential thing here is to make sure we set the object name of the First Name field so we can specify it in the “Go to Object” step. The script will go to the object we specify and then attempt to sort it by that field. We can reuse the same script and just pass in the object name of the field to control the sort. Once we get our heads around this method, extending it to have the column sort in either ascending or descending order by setting a global variable with the field name and the sort direction is relatively simple. 

Preventing Errors from being logged

We often use the Go To Next Record [Exit after Last] script when looping through records. There's absolutely nothing wrong with this method except that it will create an error when it exits the loop. FileMaker will log this error within the server logs. The error can cause local server admins some consternation – we have often fielded questions from clients saying: “This script is creating errors on the error log on the server; is there something wrong with it?” To avoid this scenario, we can simply add a quit script step calculation to exit the loop. Just before the Go to Record/Request [ Next ] step, add the following:

FileMaker-tips-and-tricks-2

This command will exit the loop when the loop gets to the last record number without throwing an error.  

Using a Hidden Object to Hide the Layout Background

By default, the layout background is usually a different color than the body part. However, when we resize the window to be larger than the body part, this can result in a weird-looking situation where the body part stops, and the layout background is revealed. 

FileMaker-tips-and-tricks-3

To solve this, we will have an object on the layout with the auto-sizing feature enabled to anchor the object to the right and bottom of the layout. But sometimes, we might not have an object to select to do that. The trick here is that even if an object is hidden – either by using a hide condition or by putting it off the layout to the right of the body – the auto-sizing for that object will still affect how the layout is displayed. We will often just put a text object at the bottom right of a layout with all four anchors on and either give it a hide condition of “1” (which will hide it all the time) or just put it just to the right of the layout. 

FileMaker-tips-and-tricks-4

And there we go! Three quick things that you can do to take your FileMaker development to the next level.

Check out more FileMaker development tips and tricks, like moving data from repeating fields and recording and tracking GPS data using the FileMaker location function. 

Keep me posted

This article is also published on FileMakerProGurus.com.

Share this entry
0 replies
BrowseMode

Sign up to receive news and information about the FileMaker platform and other custom app development tools.

Keep me posted

Most Popular

Developer Resources

News, Tips & Tricks and Demos

Archives