Board index » delphi » secondary index

secondary index

tTable.IndexFields is an indexed property that gives you the fields of the
current index. If dataToCompare is the value of the first field in the
index, then the following should do what you want.

selectedDB.SetRange ([dataToCompare], [dataToCompare]);
try
    selectedDB.First;
    while not selectedDB.EOF do
        begin
        selectedDB.Delete;
        selectedDB.First;
        end;
finally
    selectedDB.CancelRange;
    end;

Quote
Jungle <stama...@total.net> wrote in message

news:3740d27f.712953340@news.total.net...
Quote
> Hi

> I need to know if it's possible at run-time to retrieve the
> corresponding data fields of a secondary index?

> Because I want to delete some data from 3 databases
> based on different secondary indexes.

> Here is my code

> procedure DeleteData(dataToCompare: String;
>                                      selectedDB: TTable;
>                                      indexName: String);
> begin
>      selectedDB.Close;
>      selectedDB.IndexName := indexName;
>      selectedDB.Open;

>     { here I want to be able to delete all data
>        equals to dataToCompare in the selectedDB}

> end;

> Thank you

> Patrick

 

Re:secondary index


Hi

I need to know if it's possible at run-time to retrieve the
corresponding data fields of a secondary index?

Because I want to delete some data from 3 databases
based on different secondary indexes.

Here is my code

procedure DeleteData(dataToCompare: String;
                                     selectedDB: TTable;
                                     indexName: String);
begin
     selectedDB.Close;
     selectedDB.IndexName := indexName;
     selectedDB.Open;

    { here I want to be able to delete all data
       equals to dataToCompare in the selectedDB}

end;

Thank you

Patrick

Other Threads