Many years ago, I showed how to define indexes on the calculated fields of a ClientDataSet in Delphi. I haven't had need to look at that code since, as I included the index creation code as a utility procedure in the management program. Today, however, I was working on a different program and wanted to sort the data in a clientdataset in descending order (using AddIndex). When I used the name of an existing field (i.e. one defined in the sql code), AddIndex worked, but when I replaced the name of the field with a calculated field, I repeatedly received an error.
After looking for information on this topic, I finally found the answer: the calculated field has to be defined as an internal calculated field (fkInternalCalc), not as a regular calculated field. Once this has been done, the index can be defined as follows
qSigHarig.Open; qSigHarig.addindex ('idx1', 'thissig', [ixDescending], '', '', 0); qSigHarig.indexname:= 'idx1'; qSigHarig.first;
Title | Tags | ||
---|---|---|---|
412 | Rest in peace | RIP | |
980 | Health update | Health, Theanine, Donating blood | |
1533 | Weight and bp confirmed | Health |
No comments:
Post a Comment