cancel
Showing results for 
Search instead for 
Did you mean: 

Delete filtered records?

Former Member
0 Kudos

Hi Team,

I am using AdsCopyTableContents with a filter set on the source table, to copy records from source to destination.

Once copied, is there a more efficient way to delete all the filtered records in the source without having to go the .First, .Delete, .Next route?

I'm guessing Zap win't respect the filter..

Regards & TIA,

Ian

Accepted Solutions (1)

Accepted Solutions (1)

joachim_drr
Contributor
0 Kudos

what about using SQL?

Former Member
0 Kudos

HI Joachim,

Yes I could but I was hoping to do it in one step as it were while I had the AdsTable open.

I suppose I could use aAdsQuery to start with and do it all in SQL..

Will ponder.

Regards & Tks for the input.

Ian

joachim_drr
Contributor
0 Kudos

AdsZapTable will zap the complete table - so all records will be gone. As for a navigational access, it only affects one record a time. SQL always affects a record set.

Answers (1)

Answers (1)

Former Member
0 Kudos

HI Guys,

So, it turned out to be extremely simple and effective.

As the filter was already set for the Copy, after the copy it was simply a matter of looping through the filter until EOF, deleting the record each time.  Works because ADS removes the record from app visibility when deleted.

{code snippet}

  AdsCopyTableContents(_InvArch);
  //
  First;
  while not Eof do
  begin
       Delete;
  end;

{end snippet}

Ian