Data.DB.TField.CustomConstraint

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property CustomConstraint: string read FCustomConstraint write FCustomConstraint;

C++

__property System::UnicodeString CustomConstraint = {read=FCustomConstraint, write=FCustomConstraint};

Properties

Type Visibility Source Unit Parent
property published
Data.DB.pas
Data.DB.hpp
Data.DB TField

Description

Specifies an SQL string the enforces any application-specific constraints on the field's value.

Set CustomConstraint to limit the values that the user can enter into a field. CustomConstraint must be a valid SQL search expression such as

x > 0 and x < 100

The name used to refer to the field's value can be any string that is not a reserved SQL keyword, as long as it is used consistently throughout the constraint expression.

Custom constraints are imposed in addition to any constraints to the field's value that come from the server. To see the constraints imposed by the server, read the ImportedConstraint property.

Note: When setting the CustomConstraint property, be sure to set the ConstraintErrorMessage property as well, so that a message can appear when the user enters a value that violates the custom constraint.

Note: Custom constraints are SQL expressions. Because of this, always use a period (.) as a floating-point separator. This may be inconsistent with international Windows environment settings.

See Also