Sorting on TVirtualTable

Discussion of open issues, suggestions and bugs regarding Virtual Data Access Components for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
kenny
Posts: 43
Joined: Mon 15 Nov 2004 08:48
Location: Malaysia
Contact:

Sorting on TVirtualTable

Post by kenny » Wed 01 Dec 2004 08:29

Hai, is that posible to perform sorting on particular field? :?:

Paul
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Thu 02 Dec 2004 07:34

Yes, you can do it on Oracle server side. Please use
TCustomDADataSet.SetOrderBy to add 'ORDER BY' clause to SQL statement.
Or you can do it on client side inside ODAC. Please use TMemDataSet.IndexFieldNames
property. For more details please see ODAC help.

kenny
Posts: 43
Joined: Mon 15 Nov 2004 08:48
Location: Malaysia
Contact:

Post by kenny » Thu 02 Dec 2004 12:28

I used MyDac v3... and I can't found the property as you state here... can you please give me a simple code here? or any hint? Thanks!!

Paul
Posts: 725
Joined: Thu 28 Oct 2004 14:06

Post by Paul » Thu 02 Dec 2004 13:23

Sorry I wrote about DB aware components :)
Please use TVirtualTable.IndexFieldNames property. You can specify the list of fields here. Each field may optionally be followed by the keyword ASC / DESC or CIS / CS. Use ASC, DESC keywords to specify a sort direction for the field. If one of these keywords is not used, the default sort direction for the field is ascending. Use CIS keyword to compare two string fields without case sensitivity. The default value is CS - compare with case sensitivity.

Code: Select all

VirtualTable.IndexFieldNames := 'LastName ASC CIS; DateDue DESC';
You can find this property starting from MyDAC v3.10.0.5

kenny
Posts: 43
Joined: Mon 15 Nov 2004 08:48
Location: Malaysia
Contact:

Post by kenny » Thu 02 Dec 2004 13:47

Wao! that's wonderful! Thanks Paul.... I just upgrade to Mydac 3.3 then only saw the property! :D

Post Reply