Constraint Syntax
Every constraint follows this format: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
The name of the constraint. Must contain only lowercase letters, numbers, or underscores. For example:
vin, make, max_weight.CONST_TYPE
The data type of the constraint value. Supported types are:
LENGTH
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.
LENGTH entirely places no character limit on the constraint.CONST_REF
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:vinis private, must be exactly 36 characters, and is required.makeandmodelare protected and required, with no length limit.yearis protected with a default value of2024— if no year is supplied, the record saves2024automatically.coloris protected, accepts up to 20 characters, and is optional.