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

# TFieldDefs

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Collection of TFieldDef instances.

## Declaration

Source position: db.pas line 204

`type TFieldDefs = class(TDefCollection)`
`public`
`constructor Create();` |  | Create a new instance of TFieldDefs
`procedure Add();` |  | Add a new field definition to the collection.
`function AddFieldDef;` |  | Add new TFieldDef
`procedure Assign(); overload;` |  | Copy all items from one dataset to another
`function Find();` |  | Find item by name
`procedure Update; overload;` |  | Force update of definitions
`function MakeNameUnique(); virtual;` |  | Create a unique field name starting from a base name
`property HiddenFields: Boolean; [rw]` |  | Should field instances be created for hidden fields
`property Items: TFieldDef; default; [rw]` |  | Indexed access to the fielddef instances
`end;`

## Inheritance

`TFieldDefs` |  | Collection of TFieldDef instances.
`TDefCollection` |  | Definition collection
`TOwnedCollection`
`TCollection`
`TPersistent`
`TObject`

## Description

TFieldDefs is used by each TDataset instance to keep a description of the data that it manages; for each field in a record that makes up the underlying data, the TFieldDefs instance keeps an instance of TFieldDef that describes the field's contents. For any internally calculated fields of the dataset, a TFieldDef instance is kept as well. This collection is filled by descendent classes of TDataset as soon as the dataset is opened; it is cleared when the dataset closes. After the collection was populated, the dataset creates TField instances based on all the definitions in the collections. If persistent fields were used, the contents of the fielddefs collection is compared to the field components that are present in the dataset. If the collection contains more field definitions than Field components, these extra fields will not be available in the dataset.

## See also

TFieldDef |  | Class to describe one field in a record in a dataset
TDataset |  | Base class for records-based data-access

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