EPUB | CHM | PDF

TPSQLTable.Properties.IndexName

Top Previous Next

Identifies a secondary index for the table.

Syntax:

property IndexName: String;

Description:

Use IndexName to specify an alternative index for a table. If IndexName is empty, a table's sort order is based on its default index.

If IndexName contains a valid index name, then that index determines the sort order of records.

IndexFieldNames and IndexName are mutually exclusive. Setting one clears the other.

Example:

This example uses the IndexName property to sort the records in a table on the CustNo and OrderNo fields.

PSQLTable1.Active := False;
// Get the current available indexes
PSQLTable1.IndexDefs.Update;
// Find one which combines Customer Number ('CustNo') and
// Order Number ('OrderNo')
for I := 0 to  PSQLTable1.IndexDefs.Count - 1 do
  if PSQLTable1.IndexDefs.Items[I].Fields = 'CustNo;OrderNo' then
    // Set that index as the current index for the table
    PSQLTable1.IndexName := PSQLTable1.IndexDefs.Items[I].Name;
PSQLTable1.Active := True;