TBufDataset lazarus / 16-Databases ---------------------------------------------------------------------- klaatu · 2013-06-24 06:54 I am porting some code from Delphi, and in the code I use a TClientDataset as a simple in-memory database. I am trying to do the same thing with Lazarus/FPC so I am using a TBufDatatset. The first field of the data set is of type ftDateTime, and I need to search for the entry closest to a given TDateTime value. TClientDataset allows me to do this using FindNearest, but there doesn't seem to be an equivalent in TBufDataset. Can anyone please tell me whether I can achieve this using TBufDataset, and if not, what would be the simplest alternative which would require least changes to my existing code? Steve ---------------------------------------------------------------------- Lacak2 · 2013-06-26 18:57 Assuming, that you have index on TBufDataset, you can use Locate method ... but it will not stop search when "greater key" is found. If you want stop search, you must implement your own search procedure. which will iterate from 1st record and check index values values ... ---------------------------------------------------------------------- klaatu · 2013-06-30 09:46 Thanks. But if I'm going to have to implement my own search, I think I'll be better off using a different data structure and doing a binary search. Steve