Database Reference
In-Depth Information
for constructing your Boolean calculations. In either case, it's a good idea to comment your
Boolean calculations, so those who follow you can save time trying to retrace your logic.
Using the Self() Function
You got a peek at the Self() function back in the box on One or Many? . The Self() func-
tion simply returns the contents of the object to which it's applied. FileMaker's engineers
created the Self() function to make calculations portable—that is, you don't need to retrofit
them if you move them from one field or object to another.
Here's one example of how it works. The five volunteer data entry folks keeping up with
your theater group's subscription and donor list are expressing their artistic temperaments by
using different formats for phone numbers. So when you print out the contact list, you've got
(800) 555-1212, 800-555-1212, 800.555.1212, 555-1212, and every other variation under the
sun.
FileMaker's auto-enter calculations can help you transform self-expression into standard
formats. To straighten things out, you could add this calculation to your Phone field:
"(" & // start with an open paren sign
Left ( Filter ( Phone ; "0123456789" ) ; 3 ) & // grab the area code
") " & // finish the area code with a close paren and a space
Middle ( Filter ( Phone; "0123456789" ) ; 4 ; 3 ) & // grab the exchange
"-" & // give me a hyphen
Middle ( Filter ( Phone ; "0123456789" ) ; 7 ; 4 ) // the last four digits
This calculation takes the data entered into the Phone field and imposes its own order onto
the data. As the comments show, one part of the phone number format is assembled from
each line of this nested calculation.
NOTE
This formula uses several techniques covered in Chapter 10 : The Filter() function ( Text Editing
Functions ) ; Left() , Middle() , and Right() functions ( Word Functions ); and nested functions
( Planning the Calculations ).
This calculation solves the problem for one phone field, but what if all your records contain
three phone fields? Plus, you've got three phone fields in your Employees and Vendors data-
bases, too. To transfer this calculation, you have to paste it into each field's auto-enter calcu-
lation dialog box, select each instance of “Phone,” and then change it to “Mobile” or “Work
Phone” so the calculation can work properly in each new context. Don't you have real work
to do?
Search WWH ::




Custom Search