Defining New Persistent Fields

From RAD Studio
Jump to: navigation, search

Go Up to Persistent Field Components

Besides making existing dataset fields into persistent fields, you can also create special persistent fields as additions to or replacements of the other persistent fields in a dataset.

New persistent fields that you create are only for display purposes. The data they contain at run time are not retained either because they already exist elsewhere in the database, or because they are temporary. The physical structure of the data underlying the dataset is not changed in any way.

To create a new persistent field component, invoke the context menu for the Fields editor by right clicking and choose New field. The New Field dialog box appears.

The New Field dialog box contains three group boxes: Field properties, Field type, and Lookup definition.

  • The Field properties group box lets you enter general field component information. Enter the field name in the Name edit box. The name you enter here corresponds to the field component's FieldName property. The New Field dialog uses this name to build a component name in the Component edit box. The name that appears in the Component edit box corresponds to the field component's Name property and is only provided for informational purposes (Name is the identifier by which you refer to the field component in your source code). The dialog discards anything you enter directly in the Component edit box.
  • The Type combo box in the Field properties group lets you specify the field component's data type. You must supply a data type for any new field component you create. For example, to display floating-point currency values in a field, select Currency from the drop-down list. Use the Size edit box to specify the maximum number of characters that can be displayed or entered in a string-based field, or the size of Bytes and VarBytes fields. For all other data types, Size is meaningless.
  • The Field type radio group lets you specify the type of new field component to create. The default type is Data. If you choose Lookup, the Dataset and Source Fields edit boxes in the Lookup definition group box are enabled. You can also create Calculated fields, and if you are working with a client dataset, you can create InternalCalc fields or Aggregate fields. The following table describes these types of fields you can create:

Kinds of special persistent fields:

Field Kind Purpose


Replaces an existing field (for example to change its data type)


Displays values calculated at run time by a dataset's OnCalcFields event handler.


Retrieve values from a specified dataset at run time based on search criteria you specify. (not supported by unidirectional datasets)


Displays values calculated at run time by a client dataset and stored with its data.


Displays a value summarizing the data in a set of records from a client dataset.

The Lookup definition group box is only used to create lookup fields. This is described more fully in Defining a lookup field.


The following topics describe how to create different field types:

See Also