KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Determining UUID Version
PRODUCT: 4D | VERSION: 20 R10 | PLATFORM: Mac & Win
Published On: October 13, 2025
4D 20R10 introduces an enhancement to Universally Unique Identifiers (UUIDs) by implementing UUID version 7, which enables sortable UUIDs. Traditionally, the default UUIDs in 4D were version 4. According to the RFC specification, there are eight UUID versions, labeled from version 1 through version 8.

All UUID versions store their version information in bits 48 to 51 of the resulting value. Since 4D represents UUIDs as 32-character hexadecimal strings, the version is reflected in the 13th character of the UUID.
This means the UUID version can be easily extracted using the following method:
//Method: GetUUIDVersion
#DECLARE($uuid : Text) : Integer
return Num($uuid[[13]])

Because there are only 8 UUID versions, the 13th character will be a digit from 1 to 8. Since 4D only generates version 4 and version 7 UUIDs, this character should be either 4 or 7.
Here’s an example:
$UUID_v4:=Generate UUID(4)
$UUID_v7:=Generate UUID(7)

$versionNum_A:=GetUUIDVersion($UUID_v4)
$versionNum_B:=GetUUIDVersion($UUID_v7)

In the example above $versionNum_A will contain 4 and $versionNum_B will contain 7.