Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

IndexFieldNames in TClientDataset

2,932 views
Skip to first unread message

peter

unread,
Oct 19, 2005, 10:41:01 PM10/19/05
to
How to sort the clientDataset in descending order of some field, I know
there is indexfieldnames which can sort the clientdataset in ascending
order, but if in descending order, I try to write
TClientDataset.IndexFieldNames := 'FieldA desc';
error 'FieldA desc' is not found is prompted!


Kittipong Kiatcheeranun

unread,
Oct 20, 2005, 6:32:12 AM10/20/05
to

> TClientDataset.IndexFieldNames := 'FieldA desc';
> error 'FieldA desc' is not found is prompted!

IndexFieldName, it's just only Temporary index you cannot put "desc" like
that you just only can define
ClientDataset.IndexFieldNames := 'FieldA' and they will automatically sort
data in ascending for you.

If you want to sort in descending you need to create Persitent Index, it
will be like:

with ClientDataset.IndexDefs.AddIndexDef do
begin
Name := 'MyIdxA';
Fields := 'FieldA';
Options := [ixDescending];
end;
ClientDataset.IndexName := 'MyIdxA';


Regards
Kittipong Kiatcheeranun

Brian Bushay TeamB

unread,
Oct 21, 2005, 9:57:20 PM10/21/05
to

You will need to use the AddIndex method to create a new index
--
Brian Bushay (TeamB)
Bbu...@NMPLS.com

0 new messages