Conditional Formatting Tips
Conditional Formatting is currently my favorite FileMaker 9 feature. It used to be that we had to add all these extra barnacles to our database in the form of fields, calculations or relationships to highlight a simple portal row. Conditional Formatting goes a long way towards eliminating all that nonsense. CF is a big deal because for the first time in FileMaker’s product history, you can actually apply an expression (a formula) to layout objects–you can now program field objects…at least…sort of.
Yes, it isn’t exactly the feature I had in mind. I would have preferred to have full-blown access to all object properties and a way to program them using the calculation engine. But, Conditional Formatting gets me very close.
Here are a couple of basic highlighting patterns solved using CF.
1. Highlighting a Focused Field
There was quite a bit of buzz about Andy Lecates’ DevCon 2007 session where he showed off this active-field highlighting in his demo app. Andy noted that he was almost embarrassed to tell people that the formula behind this technique was literally a “1″. This puzzled me a bit so I decided to reproduce the technique. I have been told the credit for discovering this should properly be attributed to Chad Novotony of The Support Group. Kudos, Chad; it is really quite brilliant in its simplicity.
You can download the example file below and check out the conditional format properties of the fields shown.
The secret sauce behind this technique is to fill the fields with your highlight color of choice before you even open up the conditional formatting dialog box. I know this sounds completely backwards but the technique is based on the principle that a field object’s conditional formating expression isn’t evaluated when your cursor is sitting in it. So, when we enter the field, its CF stops working and the field defaults to its default fill color. So, the only thing left to do now is to make CF turn the fields white when I am not in it, which is to say, always make it white all the time. The formula for that? You guess it, “1″.
I know, I know…who would have thunk it? Kudos to Chad for this gem and to Andy Lecates for making it public.
2. Portal Row Highlighting
This next example is a bit more straightforward. We want to select a portal row and highlight it. Do accomplish this, you need two basic components, (i) an object to serve as the base CF highlight element, and ii) a script to trip the highlight. Here’s picture of the pieces before assembly…
The conditionally formatted object in this case is just a regular button set to turn blue if the value in a global variable, $$selected matches its row id. Next, make a script to set the $$selected global variable with the portal row’s record id. After that, bind that script to a “select” button inside the portal row and presto, portal row highlight without adding even one extra field!
Get the example file, conditional formatting example 1 to check this out yourself.
Cheers,
Ernest Koe
The Proof Group LLC
Comments
Leave a Reply
You must be logged in to post a comment.




