Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread RecordCount returns incorrect results after batch deletion
Tue, Oct 25 2011 8:38 PMPermanent Link

Gregory Sebastian

It looks like there's an issue with RecordCount after programmatically doing
batch deletes. I started with 1067 records. The code below deleted 41
records but Table.RecordCount after the deletes was 1031. It was only after
I did RepairTable after the deletes did the recordcount return the correct
result of 1026.

I tried repairing the table before the bulk delete but same problem. Only
after Repairing the table after the deletes did record count return the
correct result. Its not a bigdeal, I plan to pack the table after the batch
deletes but I just thought I'd report it anyway.

Regards
Greg

---------------------------------------------
DBISam : 4.30 Build 5

RecCount := tblRecipients.RecordCount;
RecsDeleted := 0;

LogAddLine(Format('Number of records to process : %d ',[RecCount]), False);
ProgressBar.Max := RecCount;
ProgressBar.Position := 0;

tblRecipients.First;
while Not tblRecipients.EOF do
begin
 if RecipientInUse(tblRecipientsID.AsString) then
 begin
   //In use
   //LogAddLine(Format('Skipped : "%s". Record still
active.',[tblRecipientsName.AsString]), false);
   tblRecipients.Next;
 end else
 begin
   //OK to delete
   LogAddLine(Format('Deleting : "%s"',[tblRecipientsName.AsString]),
false);
   tblRecipients.Delete;
   RecsDeleted := RecsDeleted + 1;
 end;
 ProgressBar.Position := ProgressBar.Position + 1;
end;
PostTable(tblRecipients, False);
LogAddLine(Format('Number of Records Deleted : %d',[RecsDeleted]), true);
Mon, Oct 31 2011 8:48 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Greg,

<< It looks like there's an issue with RecordCount after programmatically
doing batch deletes. I started with 1067 records. The code below deleted 41
records but Table.RecordCount after the deletes was 1031. It was only after
I did RepairTable after the deletes did the recordcount return the correct
result of 1026. >>

Can you send me a copy of the table prior to the deletes ?

Thanks,

--
Tim Young
Elevate Software
www.elevatesoft.com
Mon, Oct 31 2011 9:03 PMPermanent Link

Gregory Sebastian

Hi Tim,
Cancel that. Think it could be a mistake on my part. Was in the middle of
preparing a stripped down test project to send to you when I realised I
applied a filter at the start of the deletes but forgot to apply the exact
same filter after the deletes.  Sorry bout that.

Regards
Greg

Image