In version 12, FileMaker introduced a function for generating a Universally Unique IDentifier, or UUID. It follows an internet standard for generating a string value designed to be unique across space and time. These are also known as a Globally Unique Identifiers.
Why Do I Need UUID?
UUIDs have a broad range of uses. Because they are intended to be unique, you can use one as a Primary Key in database design. We all use Primary Keys in our tables to create relationships. (You DO use Primary Keys, right?) Using a UUID as a Primary Key in and of itself is not bad design, however there are considerations to be made.
You might be used to using a serial number for a Primary Key, which is valid. However, using a UUID takes advantage of easier syncing and importing from multiple users. Your keys will, theoretically, never duplicate, and you can avoid collisions.
All UUIDs Are Not Created Equal
There are several different methods used to generate a UUID. The FileMaker function Get (UUID) will generate a text string containing numbers and letters. It therefore must be saved as a Text type of field and indexed as text.
Get (UUIDNumber) is also designed to generate a universally unique value but without including any letters. This makes it suitable to use as a Primary Key defined as a Number field. This new function generates a 30-byte value, opposed to a 72-byte value for the text UUID.
“But,” you say, “I can put letters in a number field and they work.” Yes, you can, but using them as keys to relate to other values effectively strips the letters, leaving only numbers in the index. You can see this by using the GetAsNumber function on any string.
If you do that, you will likely experience a namespace collision, since the value may not be unique when only its numbers are considered. Instead, use the new Get (UUIDNumber) function, and define the field as a Number if you need a Primary Key field.
If you use a UUID for Primary Keys as well as the Get (UUID) function, your keys are all text. This can get expensive in terms of maintaining a larger index and can have implications for scaling. Number fields, on the other hand, are handled differently than Text fields, including how they are indexed. This makes a big difference as your table grows.
Of course, you can use other methods of generating a number UUID, including Custom Functions and Plugins. The benefit of having a built-in function is that you can rely on it being available when you need it. This makes your code more portable, if, for example, you need to copy/paste fields from a table in one file to another. It is also best practice to adhere to native functionality where possible. This ensures your solutions are scalable and supported as much as possible.
Plan for Usage
I look forward to utilizing Get (UUIDNumber) for solutions that are built specifically for FileMaker 17 and beyond. If your deployment includes prior versions of FileMaker, you cannot use Get (UUIDNumber). If you use any of the 17 only functionality, you require only FileMaker 17 clients as the low bar for entry. Do so by selecting the menu item File > File Options… and set Minimum version allowed to open this file to 17.0.
Moving Forward with FileMaker 17
If you have any questions about how to use the UUIDNumber or any other new features included in FileMaker 17, please contact our team. We’re happy to help your team determine the best way to leverage them within your FileMaker solution.[space=”1″]
- UUID – RFC4122
- Get ( UUIDNumber )