Select email addresses from datatable row neglecting duplicate

Hi devs, please I am iterating through an email datatable row, and sending mails for each of the row but the problem is that some of the mail addresses from the row are duplicated and as a result it sends more than one mail to the recipient.
Pls how do I select only one from the row if it is duplicated.
Example doe@yahoo.com
smith@ere.com
hanna34@hotmail.com
doe@yahoo.com

Hello @RPA-botDev

Can you try using Remove duplicate activity. Then there wont be any duplicate emeail id.

I hope you are getting this emailid from the datatable and there you are getting this duplicate.

Else you share a screenshot of the Datatable.

The datatable contains other important row values so If I use remove duplicate row it will remove the duplicated rows and the useful information in it, is there another alternative

@RPA-botDev you can make a copy of your datatable

myNewDT = DT.Copy()

Then you can use it.

maybe it is more a case of group by on email and processing the group members like:
if an email ID occurs more often, then send one email with all corresponding rows data

1 Like

Hi ppr, I think group should work for it as well, pls can you share logic code to group that row with us.Regards

have a look here for a non-Linq approach:


RegionCode is similar to your EmailID

taken from:

2 Likes

Hi PPr, please after grouping and getting the email list, jhow do I add ; to the email string and send as an email.
Example : doe@yahoo.com; k@bug.com;jerom@hotmail.com;ken@io.co.uk

give a try on String.Join(“;”, YourEmailCollectionVar)
otherwise please share with us of what you have implemented so far. Thanks

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.