Table of contents
What is a primary key in FileMaker?
A primary key is a field within a data table with which a data record (tuple) of a relation (reference table) can be uniquely identified. The primary key is the separate key within a main table that is used in the FileMaker-based gFM Business Framework each has the prefix "_pk_", for example "_pk_Kunden_ID". In gFM-Business, keys are always marked with a leading underscore so that they are at the top of the table when sorted alphabetically.
The primary key is used to link other related tables via the unique value of the primary key. In a classic 1:n relationship, the primary key "_pk_xyz" is linked to the foreign key "_fk_xyz" of the reference table.
In this example, the main table "Customers" is linked to the reference tables "Customers_Contact", "Customers_Addresses" and "Customers_Documents" via the primary key "_pk_Customer_ID". All reference tables each contain the foreign key "_fk_Kunden_ID", which is used to identify the affiliation to a specific customer data record from the main table.
Use UUID as primary key
Traditionally, a primary key is automatically filled with a consecutive number when a new data record is created. In the newer FileMaker versions, it is possible to use the Get ( UUID ) to generate a unique ID in text form - since then, primary keys in FileMaker are often also filled with a UUID.
The automatic generation of a UUID in a key field takes place in the FileMaker field options, which can be activated by clicking on [Options] can be called up in the database administration. The key field must be of type [Text] and the option "Do not replace existing field value" must be activated so that the unique UUID is retained when the data record is changed. Under the button [Specify] can now simply use the function Get ( UUID ) be entered.
Number ranges and calculated primary keys
Primary keys can also be calculated in other ways. For example, some FileMaker databases offer number ranges that are calculated according to special criteria. These keys are also unique and can be used as primary keys.
More questions about FileMaker? It's quicker in person.
As part of our Coaching and training services we will be happy to inform you personally about the FileMaker functions you need for the development of your FileMaker solution. Of course, we will be happy to respond to your individual wishes. Billing is individual and fair in 15-minute increments. Pay conveniently by bank transfer or PayPal.


