IndexFieldNames vs SortedFields
Posted: 07.04.2024, 13:59
Hi All!
I've always used IndexFieldNames to sort and it seemingly works very well. I recently started using TZMemTable (very nice btw!) and ran into the issue that the base class for all of the various TZDataSet classes is TZAbstractRODataset and its IndexFieldNames property is protected (and so I'm using the standard "TZDatasetHack = class(TZAbstractRODataset);" hack to get access to it, but that's not ideal.) In looking at the code I noticed that there is a public "SortFields" property that seems similar. However, I often do multi-level sorts where ASC or DESC is on the field level (i.e. IndexFieldNames := 'EMPNAME ASC; EMPSALARY DESC" and it looks like perhaps SortFields doesn't allow that.
So basically, two questions:
1. What's the story on IndexFieldNames vs SortedFields?
2. Would promoting IndexFieldNames to public be possible or is there some reason to keep it protected?
Thanks, as always!
-Mark
I've always used IndexFieldNames to sort and it seemingly works very well. I recently started using TZMemTable (very nice btw!) and ran into the issue that the base class for all of the various TZDataSet classes is TZAbstractRODataset and its IndexFieldNames property is protected (and so I'm using the standard "TZDatasetHack = class(TZAbstractRODataset);" hack to get access to it, but that's not ideal.) In looking at the code I noticed that there is a public "SortFields" property that seems similar. However, I often do multi-level sorts where ASC or DESC is on the field level (i.e. IndexFieldNames := 'EMPNAME ASC; EMPSALARY DESC" and it looks like perhaps SortFields doesn't allow that.
So basically, two questions:
1. What's the story on IndexFieldNames vs SortedFields?
2. Would promoting IndexFieldNames to public be possible or is there some reason to keep it protected?
Thanks, as always!
-Mark