FileMaker 17 – UUID number

FileMaker Pro 17 has a new function for generating universally unique identifiers – Get(UUIDNumber). Why would you use it? Read on.

UUID

A universally unique identifier (UUID) is designed to be limited to one instance of that specific string in the entire world past, present and future. That means that if a million monkeys generated one UUID a second for the next million years, no two UUIDs would be the same.

While the probability of no duplicates is not zero, the likelihood of duplicates is so close to zero that it might never happen in any one system. So you can create UUIDs to uniquely identify objects such as records in a table, and know that each UUID will be different to every other existing and future record in that table (and every other table).

Types of UUID

There are standards applied to the generation and structure of UUIDs. At their heart, they are a 128-bit number but may be represented as 32 hexadecimal (base 16) digits in 16 pairs. An example is:

16776D83-EBE1-4AD8-B131-51AFB7E33E1D

There are many variants of UUID in use. The Get(UUID) function in FileMaker Pro has been available since version 12. It generates a version 4 UUID using a random number seed.

Uses of UUID

It is common practice to generate a UUID for primary key data in a table. This will mean that all records can be uniquely identified as is needed in a relational database structure. You can read more about how to do this in the previous post The A-Z of FileMaker: G is for Get.

A UUID could also be used as a unique access identifier. You could create a calculation field using a UUID function. Then select Do not store calculation results in the Storage Options. Every time a record is accessed, a new ID is generated.

So why the new UUID in FileMaker Pro 17?

FileMaker Pro 17 introduces a new UUID – Get(UUIDNumber) – which returns a unique, 24-byte (192-bit) number. An example is:

4834366009124897899475462287919682524896572646284376517480

This has been added specifically for the generation of primary key data. Since it is a pure number, it has been shown to improve relational performance. When using Get(UUID), the primary key field must be a text field;  with Get(UUIDnumber), the primary key field is a number field.

Interesting Fact

Number fields have smaller indexes than text fields

FileMaker Pro 17 creates a number of default fields in a new table. One of these is called PrimaryKey and is configured as a text field with an auto-entered Get(UUID) value. You may want to change this to a number field and use the new Get(UUIDnumber) function.

Compatibility Warning

If you are going to use the new Get(UUIDnumber) function, ensure that only FileMaker 17 clients access the database. You can do this in File > File Options… and set the Minimum version allowed to open this file to 17.0.

If you open a file that uses the new function in a version previous to 17, the function will appear as Get ( <Function Missing> ). And it will return a ? result when triggered.

Leave a Reply

Your email address will not be published. Required fields are marked *