I'm importing a large Excel spreadsheet into a TAdvStringGrid. One of the things that I am wanting to do after sorting the data in a user-defined way is to return only distinct values in columns in order to build a prospect list without having duplicates
For example if column 1 is name and column 2 is address and they values are :
John Smith 123 Main Street
John Smith 123 Main Street
John Smith 894 14th Street
John Smith 14 Riverside Drive
John Smith 123 Main Street
John Smith 894 14th Street
I only want to return
John Smith 123 Main Street
John Smith 894 14th Street
John Smith 14 Riverside Drive
so that there are not multiple contacts listed, even though the person appears in multiple rows.
What would I need to do to accomplish this? Would it need another grid or some other intermediate step, or can I set it to return unique values based on a set of columns?
You would need to put the data into one column and then you could call:
grid.RemoveDuplicates(column, case-sensitive)
last parameter defines whether to perform a case sensitive or non case sensitive check for duplicates.