FileMaker Global Fields As Key Fields?

From Dwayne Wright PMP, PMI-ACP, CSM
Certified FileMaker Developer

WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

Can a field stored as a global be used as a key field? The answer is yes and no. As you may know, global fields cannot be indexed. So they cannot be used in key fields, don’t you think?

Actually, the parent key doesn’t need to be indexed. The parent record is one record that looks outward to related records. Another way to look at it is that the key field that is attached to the layout you are on can be unstored. An index of a single record will always be a single record. So you can have globals in the table used in the current layout of the relationship ( remember, relationships in FileMaker 7 and higher are bi-directional ).

The use of global fields as parent key fields can be cool because we can do some very inventive things with it. The most common is have a global as a relational switch. The relationship can change drastically by changing a global field as the primary key or a global field(s) as part of a calculation field of a primary key. Take a look at our example files, you will see global fields in the primary key quite often.

However, it will break if you try to go the other way around in the relationship, due to the bidirectional nature of FileMaker relationships. I will have a large full discussion on context in a later discussion. FileMaker relationship context is not hard to understand, after you understand it. It is one of those light bulb moments that once you get it, you don’t see why you struggled with it. That is unless, you try to explain to someone else in a written discussion (oh hey, that’s me, grin).

Here you can see the storage setting dialog for a field. You can seel that it is named with pk as a parent key field. You can also see that it says it's my record id field. That is not something you can do. It's a mistake. I took this snapshot just as an illustration for this discussion. It's is not the way any of my databases are setup. I thought about fixing it but thought perhaps I leave it. Just so that I can illustrate a little more about the fine points of parent key fields.

=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2007 - Dwayne Wright - dwaynewright.com

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.