|
|
FILEMAKER PRO 9
Conditionally Format Layout Objects in FileMaker Pro 9
Create better layouts and help users navigate your solutions by putting the conditional formatting feature to work.
Subscribers: Sign-in to activate download link -- Example file showing how to use conditional formatting.
UNLOCKED -- This article is provided to subscribers of FILEMAKER ADVISOR or DATABASED ADVISOR or FILEMAKER ADVISOR. To subscribe or renew, go to Advisor Store.
Conditional formatting tops the list of cool new features in FileMaker Pro 9. For years, I've wished we could vary the color, font size, and appearance of layout objects. I've done all sorts of tricks and workarounds to highlight selected portal rows, gray out buttons, or make different values appear in different colors. It's all now so much easier.

Figure 1: It's hard to tell what's missing -- A column of text values all with the same font size. Some fit in the space, others don't.

Figure 2: Much better -- A column of text values, with varying font sizes. Now they all fit in the available column.

Figure 3: Conditional Formatting dialog -- Notice the user has control over the order of the test conditions.

Figure 4: Text Format dialog -- Click on the "More formatting" button in the Conditional Formatting dialog to get here. This example only specifies the font size, but the font itself, as well as the style, text color, and fill color are all options.

Figure 5: Pre-set conditional value tests -- You can use these formulas instead of writing your own calculations.
To give you some ideas, here are a few possible uses for conditional formatting:
- Gray out unavailable buttons or tabs
- Highlight the current sorted column
- Highlight empty fields
- Gray out inactive records
- Highlight the selected portal row
- Display field labels in the field space
- Reduce font size on longer text strings to fit fixed-length fields
- Expand text size with window size (combine with the Autoresize feature)
- Highlight fields for data entry based on user account.
To follow along with the examples I describe in this article, subscribers may download the example file.
Control font size
Here's a simple example: In a list of records, some text values are of greater length than others. Before conditional formatting, you had to stretch the field to be long enough to accommodate the longest likely value, otherwise the longer values would get truncated. This feature is even more important with numeric or date values, which appear as a question mark when they don't fit entirely in the field (figure 1).
But by using conditional formatting, you can vary the font size so longer text values fit better into the space available (figure 2).
You set multiple conditions in Layout mode, using the Format > Conditional Formatting menu item (figure 3). The object appears with the formatting associated with all the qualifying conditions, unless multiple conditions set the same attribute (i.e., color), in which case the last qualifying condition wins. (This is in contrast to the Case statement and other logical functions, which stop evaluating after matching the first true test.)
In this example, the condition tests for the text length of the value in the field. The first condition tests for values greater than 12 characters long. Such values will appear in 10-point font (figure 4).
The second condition tests for values greater than 15 characters in length and displays them as 9 point. The third condition tests for values greater than 18 characters long and displays them at 8 point.
Again, a value that is 20 characters long satisfies all three conditions. FileMaker Pro evaluates the conditions in the order in which they display, and uses the formatting associated with the last qualifying condition. For this reason, you can rearrange the order of the conditions by clicking on the double-headed arrow and dragging them up or down.
TIP: Notice in the example I used the new "Self" function (rather than the field name). This function lets me copy and paste formulas, or even, better yet, use Custom Functions to centralize my conditional formulas.
It isn't necessary to write your own formulas, either. A variety of hard-coded formulas are available in a drop-down menu. Some are more appropriate to text fields, others to number or date fields (figure 5).
Paul Mitchell has eight years of experience working with FileMaker Pro, including nearly four years with the FileMaker, Inc., Technical Support team and almost four years as an in-house developer for a printer of retail signage. Before FileMaker Pro, he served in the U.S. Air Force, and held jobs in a variety of industries. Today, he's a technical manager at Soliant Consulting.
Keyword Tags: FileMaker, FileMaker Development, FileMaker FileMaker Pro
ADVISORAMA You must be a believer before you can become an achiever.
|
ARTICLE INFO
Web Edition: 2008 Week 11, Doc #19430Print Edition: April/May 2008, Page 18
ARTICLE LOCKED
File: Example file showing how to use conditional formatting. Subscribers, log-in for Download link.
|
FileMaker Advisor Sponsors
|

Read the advanced guide to creating custom business database solutions with FileMaker software. Subscribe now to gain access to all the archives and downloads.![]() 
Learn the fundamentals of using FileMaker Pro software. Every issue gives you step-by-step instructions on creating the databases you need. Subscribe now!![]()  ![]()
![]()

See exactly how to do it, step-by-step, in Advisor Academy CDs created by the top experts. Click to see what you can learn right now.![]() 
Keep up! Hot News, How-To, Tips & Tricks, Expert Advice, and more. Click to request your's free.![]()  ![]()

What direction are you going with your business? Advisor Guides are packed with the answers you need to work smarter. Can you afford to fall behind?![]() 
Submit your tips, techniques and advice and let Advisor promote your business and build your career. Show the world what you know!![]()  ![]()
|
|