Skip to main content

TcxDBDataController.DetailKeyFieldNames Property

Identifies one or more field names in the dataset used by the current detail data controller.

Declaration

property DetailKeyFieldNames: string read; write;

Property Value

Type
string

Remarks

To establish master-detail relationships between two datasets, you have to create a data controller for each and set detail & master key field names via the DetailKeyFieldNames and MasterKeyFieldNames properties of the detail controller. Thus you link two datasets by specific fields. The detail data controller will represent the data corresponding to a specific record in the master data controller.

Let’s examine two tables: Customers and Orders. The Orders table stores information on orders made by different customers. Both tables contain the CustNo field, which uniquely identifies customers. Assume you want to display orders made by customers by navigating through the Customers table. In this case the Customers table is the master table and Orders is the detail table. Create data controllers for the Customers & Orders tables and set the DetailKeyFieldNames & MasterKeyFieldNames properties of the detail data controller to ‘CustNo’. The MasterKeyFieldNames property identifies the CustNo field in the Customers table and the DetailKeyFieldNames property identifies the CustNo field in the Orders table.

To link two tables by several fields, you need to specify their names in the DetailKeyFieldNames and MasterKeyFieldNames strings, separating them by a semicolon.

If the detail data controller is bound to a dataset other than a parameterized query, you have to sort the records by the fields identified by the DetailKeyFieldNames property. In this case, a detail data controller will correctly retrieve all the corresponding records. Otherwise, not all records can be located and retrieved from the detail dataset.

See Also