Sorting table.

Hi,

In the application I am developing, a TTable and a DBGrid is used to search for addresses. I'm using a Paradox-table for the data storage.

I want the DBGrid to be sorted on the Name-field. This field (Name) as well as the field Number do have an index.

How can I give the TTable or DBGrid the right sorting?

Thank you for helping.
roosiedbAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
kotikConnect With a Mentor Commented:
Hi!
Simply set the TTable.IndexName  or TTable.IndexFieldNames property.

F.e.:
  Table1.IndexName := 'NAME_IDX';
or
  Table1.IndexFieldNames := 'NAME_IDX; NUMBER_IDX'; // <- this will sort first by name, then by number

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

DBGrid will show data as it is sorted in its DataSet property.

Regards,
  Kot.
0
 
roosiedbAuthor Commented:
Thank you, this is working OK.

Please let me grade you for the points...
0
 
ITugayCommented:
click "accept comment as answer"
0
 
roosiedbAuthor Commented:
Sorry, I didn't see that button.

Thank you.
0
All Courses

From novice to tech pro — start learning today.