In the spirit of last week’s post, I’m offering up another arcane function whose utility wasn’t immediately obvious to me. Let’s start in the Define > Database window’s Fields tab. When creating or editing a field, you must, of course, give it a name. FileMaker is pretty generous with field names- they can run up to 100 characters long and there aren’t a whole lot of rules restricting what you can put in there. Realistically, though, field names that run over 25 characters or so become unwieldy to deal with on layouts and in calculations. The developer’s challenge is to craft names that are at once compact and meaningful enough to describe their purpose.
Usually, naming a field isn’t a big deal; nameFirst and nameLast are unambiguous. But suppose that, for whatever reason, your database requires one calculation field combining the first initial and last name in reverse order with a comma? You could call it nameLastCommaFirstInitial and it wouldn’t be so bad. But how might you name a field that summarizes event attendence by state only counting attendees who have a primary address outside of the state where the event was held? You may scoff, but spend enough time making databases for other people and you’ll get requests like that. There’s a point at which the purpose of the field can not be adequately contained in a field name.
FileMaker has provided the field comment box since (I think) version 7. Here you have another hundred characters to explain the field’s purpose or rationale, which is great when you’re in the Define Database window with that particular field selected. Unfortunately, the time that field comment can really help you is when you’re looking at it on a layout or constructing a calculation and you just can’t remember what sum_ExternAttendEventState is supposed to do.
Here’s where our friend the FieldComment function can assist.
FieldComment ( fileName ; fieldName )
Fill in the appropriate file and field names (be sure to use the fully qualified field name in the form of tableName::fieldName) and FieldComment will display the comment line from the field’s definition.
When picking apart a database that you didn’t create (or haven’t worked on in years) you can have easy access to field comments without ever leaving Browse mode by saving the following calculation in your data viewer:
Get ( FileName ) ;
Get ( ActiveFieldTableName ) & “::” & Get ( ActiveFieldName )
Now, when faced with an unfamiliar field, you can click into it and open your data viewer to read its comment: no detour to Define > Database necessary.