Skip to main content
Standard definitions are a special type of Standard that act as enumerations. You use them when a field in your data should only ever hold one of a fixed set of known values — for example, a status, a category, or a color. By defining the allowed values once in a Standard definition, you enforce them automatically every time a record is created or updated.

Defining a Standard Definition

A Standard definition uses the def keyword to declare each allowed value. The syntax mirrors a regular Standard but contains def entries instead of typed constraints:
Each def entry maps a name (e.g. red) to a string value (e.g. "RED"). The name is what you use in code; the value is what gets stored in the record.

Using a Standard Definition as a Constraint

Reference a Standard definition in another Standard using the standard type and the @ prefix on the definition’s reference:
When a value is passed to the vehicle Standard for the type constraint, the system validates that it matches one of the values defined in the color Standard definition. Any value that does not match will be rejected before the record is saved.
Standard definitions enforce their allowed values at write time. If you add or remove a def entry from a Standard definition, existing records are not retroactively updated — only new writes are validated against the updated definition.

Creating Records with Standard Definitions

When you use a Standard definition in a creation query, you have three equivalent ways to supply the value — use whichever is most readable in context:
The same flexibility applies to delete and find queries:
Using the @CLR.red form is the most explicit option and makes it immediately clear to anyone reading the query that color is a Standard definition constraint rather than a plain string field. Prefer it in shared or production code.