[Lazarus] Sorting BufferDataset

Santiago A. svaa at ciberpiula.net
Mon Apr 13 12:39:49 CEST 2020


Hello:

I'm trying to sort a TBufferDataset by several criteria, and I'm a 
little confused.

There is no sort method, so I decided to use indexes, but I have a lot 
of doubts.

When you close the TBufferDataset, all the data is cleaned.

TbufferDataset has a MaxIndexesCount that limits the number of indexes. 
By default this property is intialized to 2, and two indexes are created 
and used by default as soon as you call addIndex. So you must call 
addIndex before opening the table, or set MaxIndexesCount to at least 3 
in order to be able to add an index with the table active. (you can't 
close the table to add new index or you'll lost data).

There is no way to drop a single index, and there is no way to change 
the index fields on the fly, you must call clearIndexes. And to call 
clearIndexes, before you must close the dataset, and so loose data. Am I 
right?

So, if I want to process the dataset in different orders with 
TbufferDataset, before opening the dataset I must set MaxIndexesCount to 
all the orders I'm going to use.

Am I right? Or I have missed something?

By the way, What does the index option "ixNonMaintained" mean?

-- 
Saludos
Santiago A.



More information about the lazarus mailing list