Recent

Author Topic: Sorting records with tdbf?  (Read 11411 times)

Mortimur

  • Newbie
  • Posts: 5
Sorting records with tdbf?
« on: April 10, 2007, 01:28:10 pm »
Hi,
I'm sorry for my somewhat stupid question, I'm a newbie around here.
I'm looking for a way to sort the records in a tdbf table grid according to the values of one of the fields.
Is there any implemented way to do this, or i should write my own procedure?
I was looking around in the documentation of tdbf and around the net, but couldn't find anything like that.

Javis

  • New Member
  • *
  • Posts: 17
RE: Sorting records with tdbf?
« Reply #1 on: April 10, 2007, 02:15:24 pm »
Use the IndexName property. Yo can sort the table according an index in the table.

Mortimur

  • Newbie
  • Posts: 5
Sorting records with tdbf?
« Reply #2 on: April 10, 2007, 04:03:19 pm »
Ok I'll assign indexes to the records, but still the sorting algorithm I should write myself, right?
I am looking for an easy way to do this.

Javis

  • New Member
  • *
  • Posts: 17
Sorting records with tdbf?
« Reply #3 on: April 10, 2007, 08:44:19 pm »
No, you cant. It sort automatically.

Try that.

Dbf1.AddIndex('FIELDA', 'FIELD', []);  //Ascending
Dbf1.AddIndex('FIELDD', 'FIELD', [ixDescending]);  // descending
 
Then set using:
 
Dbf1.IndexName := 'FIELDA'; // or 'FIELDD'

Mortimur

  • Newbie
  • Posts: 5
Sorting records with tdbf?
« Reply #4 on: April 10, 2007, 09:33:49 pm »
And if i want to sort by multiple fields?
Like i have records in a field that are equal, and then to sort them by another field?

Javis

  • New Member
  • *
  • Posts: 17
Sorting records with tdbf?
« Reply #5 on: April 11, 2007, 09:52:19 pm »
Dbf1.AddIndex('index2', 'FIELD1+FIELD2', []); //Ascending

Then set using:

Dbf1.IndexName := 'index2'; //

Mortimur

  • Newbie
  • Posts: 5
Sorting records with tdbf?
« Reply #6 on: April 14, 2007, 10:46:29 pm »
Thank you very much!

mateus7778

  • New Member
  • *
  • Posts: 14
cdx/NTX
« Reply #7 on: September 26, 2007, 02:00:59 pm »
HI!!

I have the almost the same problem... but I already have a (big) program using xHarbour with DBF+NTX, and another using DBF+CDX. How use an existing indexes in CDX or NTX????

THANKS!!

Mateus






Quote from: "Javis"
Dbf1.AddIndex('index2', 'FIELD1+FIELD2', []); //Ascending

Then set using:

Dbf1.IndexName := 'index2'; //

 

TinyPortal © 2005-2018