[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'db' (#fcl)

# TField.CustomConstraint

Custom constraint for the field's value

## Declaration

Source position: db.pas line 421

`published property TField.CustomConstraint: String read FCustomConstraint write FCustomConstraint;`

## Description

CustomConstraint may contain a constraint that will be enforced when the dataset posts it's data. It should be a SQL-like expression that results in a True or False value. Examples of valid constraints are:

    Salary < 10000
    YearsEducation < Age

If the constraint is not satisfied when the record is posted, then an exception will be raised with the value of ConstraintErrorMessage as a message.

This feature is not yet implemented in FPC.

## See also

TField.ConstraintErrorMessage |  | Message to display if the CustomConstraint constraint is violated.
TField.ImportedConstraint |  | Constraint for the field value on the level of the underlying database

The latest version of this document can be found at lazarus-ccr.sourceforge.net.