0

I execute the following code in Delphi:

MyClientDataSet.IndexFieldNames:='FIELD1;FIELD2;FIELD3'

And I can see that MyClientDataSet.RecordCount shows reduced number of records while this temporary index is active. If I make the while loop:

while not MyClientDataSet.Eof do begin
  //... some code
  MyClientDataSet.Next;
end;

then only part of the records are visited in this loop while the temporary index is active. Records are lost without any specific order: some of the lost records can have nil values in their indexed fields and some of the lost records have all fields with values. Is such behavior by design or I have discovered some ClientDataSet bug (maybe dependent upon some specific version of midas.dll library) or I need to configure my TClientDataSet in some specific way (I can not imagine - how)?

I am working with Delphi 6 but I guess that the problem can be in later Delphi versions as well.

TomR
  • 2,696
  • 6
  • 34
  • 87
  • 1
    This is obviously not by design. To get any help with this, I think you are going to add an MCVE to your q, which includes the insertion, in code, of a few records which are "lost" by applying your index. Otherwise, if readers can't reproduce this problem, they are unlikely to be able to help. – MartynA Aug 18 '17 at 07:35
  • 2
    In order to discard issues with Midas.dll versions, add MidasLib to the project uses clause. It will cause all Midas code to be linked. I can tell you that I used TClientDataSet with Delphi 6 for more than 10 years and I didn't have anything like that. – Alexandre M Aug 18 '17 at 08:40
  • I didn't manage to prepare MCVE - minimal version worked correctly. But upgrade from midas.dll v14/2009 to midas.dll v19/2013 solved the problem. There is similar problem in Russian side with the detailed description where the error arise: http://www.cyberforum.ru/post2626822.html – TomR Aug 18 '17 at 11:34
  • 1
    Setting IndexFieldNames only affects sort order; it does not affect the availability of rows. I've used TClientDataSet in apps from D2007 all the way through Berlin, and have never observed this behavior. Can you post some sample data (including the field definitions) that will demonstrate this behavior? – Ken White Aug 18 '17 at 15:53

0 Answers0