Random Strings as IDs

Opt for shorter strings as IDs in your data types

By default all the global data and page data folder types use the GUID type as a key field type, for example: 66246706-8fce-4f75-bfd2-c49e65d7e3a3

In some cases, a long string like this is undesirable (for example, in data URLs). Starting from version 5.0, you can use a YouTube URL-like random string instead, that comes in two flavors:

  • 4-character random string, e.g.: pZXs
  • 8-character random string, e.g.: pZ-klYOq

When the string is 8 characters long, it is randomly generated; when it is 4 characters long, every new data item (record) will be checked against possible key collision before being added.

Note. This feature is only available for global data types and page data folder types.

When creating a data type, you can choose what type to use as the key field: a GUID, a random 4-character string, or a random 8-character string. You cannot change the key field type, though, when editing an existing data type.

To select the type for the key field:

  1. From the "Data" perspective, create a data type (global or page data folder).
  2. On the "Fields" tab, select the key field (named "Id" by default).
  3. On the "Basic" tab in the "Key field type" field, select the type:
    • Guid
    • Random String, 4 characters long
    • Random String, 8 characters long
  4. Make other changes to the data type.
  5. Save the data type.

Changing the type of the key field in a data type


C1 CMS version 5.0 or later