FileMaker® Pro Tip-n-Trick: Smart & Simple Column Sort

By: RJ Carroll

One of the most-requested features from FileMaker Pro developers is a one-click simple column sort. Trying to sort out how to sort can be a tricky business. The typical way to implement column sort from list-view is by using buttons above each column. First, the user calls a script by clicking on a field name in the column header. Usually, the script includes a number of hard-coded “Sort Records” steps.  Then, the script decides which field to sort and how from a series of If/Else If steps. Each order of each potential field would require its own script step.) Scripts like this leave a lot of things to change if you add or delete fields. (They also leave a lot of code to maintain in general.) Before FileMaker introduced “Sort Records by Field”, this was basically the only sort of way to do it (pardon the pun).

Sort Records by Field

A simpler approach is to leverage the power of “Sort Records by Field.” One advantage of “Sort Records by Field” is that, unlike “Sort Records,” you can leave the field unspecified and use the context of the currently active field. It also eliminates the need for extensive “If…Else” branching logic and hard-coded sort orders in the sorting script. The only issue with using “Sort Records by Field” this way is that when a user clicks a button on the layout, the user isn’t actually in the field when the script gets called. Most users would expect to click a button (such as the field’s name) in the column header to call a sort script, but since clicking a button takes you out of the field, it won’t work. So what do you do?

From Button to Trigger

One clever workaround: place copies of the fields you want for sorting in the header and use an OnObjectEnter trigger to invoke the script. This eliminates all need for script parameters and branching logic altogether. It also allows for powerful one-click column sorting. Just style those fields to look like “sort buttons”. Now have an elegant method for sorting by columns that is simple and easy. It is also manageable, easy to maintain as your solution changes. Check out this implementation by downloading our demo file. I think you’ll find it’s remarkably simple with this technique to get all your sorting quickly sorted out.

Download the demo file and give it a sort!

filemaker pro simple column sort graphic

*This FileMaker how-to article is provided for free and as-is, use, enjoy, learn, and experiment at your own risk – but have fun! Excelisys does not offer any free support or free assistance with any of the contents of this blog post. If you would like help or assistance, please consider retaining Excelisys’ consulting & development services.

About Excelisys, Inc.: Founded in 2001, Excelisys ( is an FBA Platinum Partner and FileMaker Certified developer organization. Excelisys specializes in designing, developing, customizing, supporting, consulting, migrating, upgrading, fixing, and integrating of database solutions for Desktop, Mobile, and Web. Our core technology competencies are FileMaker Pro, FileMaker Go, PostgreSQL, and MySQL for database frameworks. Complimenting those database frameworks we have competency with WordPress, PHP, CodeIgniter, Joomla, Drupal, Magento, CSS, HTML5, and Javascript for web sites and web applications.
Aside from providing excellent customer service, our goals are to use these technologies to intuitively automate your organization’s data solution needs seamlessly and flawlessly across the web, mobile, and desktop platforms. Contact Excelisys today for a free estimate and consultation regarding your business software automation needs @ 866-592-9235.

Excelisys, Inc. is an independent entity and this web site/information/blog post has not been authorized, sponsored, or otherwise affiliated with FileMaker, Inc. FileMaker is a trademark of FileMaker, Inc., registered in the U.S. and other countries.