Board index » delphi » Looking for records with repeated data

Looking for records with repeated data

"<<<<  L R G M  >>>>" <luis...@bellsouth.net> wrote:

Quote
>I have been using the LOCATE method to find out records in my DB tables. All is OK when I use it with Customer_Number key field (it has just one instanace), but others like First_Name or Last_Name can have repeated values in my long Customer.DB table. Although, I only can get the first of them. To sum it up, I want to create a searching routine loop usefull to keep in an ARRAY as many as repeated data I could find in the chosen FIELD.

My suggestion is to make (add) another TTable or TQuery to find those
records.

You can use TTable with a filter or TQuery with SQL. Either way, the
returned dataset will have all your duplicates.

If you already know the value you are trying to find, you can do this
with any dataset:

MyLookUpValue :=  'Ernesto'
TTable.First;
while not TTable.EOF do
        begin
        if TTable.FieldByName('First_Name').AsString = MyLookupValue then
                        {do somthing to the values}
        TTable.Next
        end;

You can use either a TTable or TQuery this way.

HTH

Phil Cain
--

 

Re:Looking for records with repeated data


A simple way is to use Filter/OnFilterrecord event. Then call FindNext to
loop through. You don't have to set the filtered property to be true.

<<<<  L R G M  >>>> <luis...@bellsouth.net> wrote in article
<7cpv3p$80...@forums.borland.com>...
About the Locate Method
I have been using the LOCATE method to find out records in my DB tables.
All is OK when I use it with Customer_Number key field (it has just one
instanace), but others like First_Name or Last_Name can have repeated
values in my long Customer.DB table. Although, I only can get the first of
them. To sum it up, I want to create a searching routine loop usefull to
keep in an ARRAY as many as repeated data I could find in the chosen FIELD.
Finally, what is a practical way to show these selected data to pick up the
record I really want to see.
Biginner requesting help.

----------

Other Threads