Page 1 of 1

Sorting on TVirtualTable

Posted: Wed 01 Dec 2004 08:29
by kenny
Hai, is that posible to perform sorting on particular field? :?:

Posted: Thu 02 Dec 2004 07:34
by Paul
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.

Posted: Thu 02 Dec 2004 12:28
by kenny
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!!

Posted: Thu 02 Dec 2004 13:23
by Paul
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

Posted: Thu 02 Dec 2004 13:47
by kenny
Wao! that's wonderful! Thanks Paul.... I just upgrade to Mydac 3.3 then only saw the property! :D