Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Sorting table.

Posted on 2000-05-06
4
174 Views
Last Modified: 2010-04-04
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.
0
Comment
Question by:roosiedb
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
kotik earned 50 total points
ID: 2784281
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
 

Author Comment

by:roosiedb
ID: 2785318
Thank you, this is working OK.

Please let me grade you for the points...
0
 
LVL 9

Expert Comment

by:ITugay
ID: 2785398
click "accept comment as answer"
0
 

Author Comment

by:roosiedb
ID: 2785560
Sorry, I didn't see that button.

Thank you.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question