TMemDataSet.IndexFieldNames Property

Used to get or set the list of fields on which the recordset is sorted.




property IndexFieldNames: string;


Use the IndexFieldNames property to get or set the list of fields on which the recordset is sorted. Specify the name of each column in IndexFieldNames to use as an index for a table. Column names order is significant. Separate names with semicolons. The specified columns don't need to be indexed. Set IndexFieldNames to an empty string to reset the recordset to the sort order originally used when the recordset's data was first retrieved.

Each field may optionally be followed by the keyword ASC / DESC or CIS / CS / BIN.

Use ASC, DESC keywords to specify a sort order for the field. If one of these keywords is not used, the default sort order for the field is ascending.

Use CIS, CS or BIN keywords to specify the sort type for string fields:

CIS - compare without case sensitivity;

CS - compare with case sensitivity;

BIN - compare by character ordinal values (this comparison is also case sensitive).

If a dataset uses a TCustomDAConnection component, the default value of the sort type depends on the TCustomDAConnection.Options option of the connection. If a dataset does not use a connection (TVirtualTable dataset), the default is CS.

Read IndexFieldNames to determine the field or fields on which the recordset is sorted.

Sorting is performed locally.


You cannot sort by BLOB fields.

IndexFieldNames cannot be set to True when TCustomDADataSet.UniDirectional=True.


The following procedure illustrates how to set IndexFieldNames in response to a button click:

DataSet1.IndexFieldNames := 'LastName ASC CIS; DateDue DESC'; 
© 1997-2022 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback