Skip to main content
Constraints are the building blocks of every Standard. Each constraint defines a single field in a Standard — specifying how it can be accessed, what type of value it holds, how long that value can be, and whether it is required. Understanding the full constraint syntax lets you model your data precisely and enforce rules at the schema level.

Constraint Syntax

Every constraint follows this format:
The sections below describe each part of the syntax in detail.

ACCESS_TYPE

The access type controls the scope in which a constraint can be read or written.
private
Only accessible in the constructor when initially setting the value. Once a record is created, this value cannot be changed.
protected
Can be publicly read but only written to in the constructor. Use protected for fields that should be visible everywhere but set only at creation time.
public
Allows read and write access from any point or user within the package. Use public for fields that need to be freely updated after record creation.
global
Can be read from anywhere but only manipulated from within the package. Use global for system-level fields that external callers should see but not modify.

CONST_NAME

CONST_NAME
string
required
The name of the constraint. Must contain only lowercase letters, numbers, or underscores. For example: vin, make, max_weight.

CONST_TYPE

CONST_TYPE
string
The data type of the constraint value. Supported types are:

LENGTH

LENGTH
integer
The number of characters accepted, expressed as an integer. You can optionally append ! to enforce an exact length.
  • string:36 — the value can be up to 36 characters.
  • string:36! — the value must be exactly 36 characters.
Omitting LENGTH entirely places no character limit on the constraint.

CONST_REF

CONST_REF
string
A shorthand reference for the constraint that enables quick access in queries. For example, if the Standard school has reference SCH and its street constraint has reference SADDR, you can access that field as SCH.SADDR anywhere in your system.

DEFAULT_VALUE or REGEX

"DEFAULT_VALUE" | "/REGEX/"
Provide a default value in double quotes to use when no value is supplied for this constraint. If no default is set and no value is provided, the saved value will be NULL.Alternatively, provide a regex pattern (also in quotes, surrounded by / delimiters) to require that any submitted value matches the pattern before the record is saved.

Required Marker (*)

When a constraint ends with *, a value must be provided. If the calling code does not supply a value for that constraint, the record will be rejected entirely.

Full Example

The following Standard demonstrates all constraint options together:
  • vin is private, must be exactly 36 characters, and is required.
  • make and model are protected and required, with no length limit.
  • year is protected with a default value of 2024 — if no year is supplied, the record saves 2024 automatically.
  • color is protected, accepts up to 20 characters, and is optional.
Omitting * on a constraint makes it optional. If you also omit a default value, the record will store NULL for that field when no value is provided. Make sure NULL is an acceptable state for optional constraints in your application logic.