Remove duplicate row contains value

Hi All,
I have datatable as follows:

DailyMail1,not found
DailyMail1,is found
DailyMail2,is found
DailyMail2,not found
DailyMail3,not found
DailyMail4,not found

If the value is repeated more than once and contain “is found”, I want to remove the row contains “not found”.

in this case DailyMail1 and DailyMail2 not found should be remove. Others than that, I want to keep.

please help.

give a try at

Assign activity
dtFiltered =

(From d in YourDataTableVar.AsEnumerable
Group d By d(0).toString.Trim Into grp=Group
Let gFilter = grp.Where(Function (x) x(1).toString.ToUpper.Equals("IS FOUND"))
Let gFinal = If(gFilter.Count > 0,  gFilter, grp)
From g In gFinal
Select r = g).CopyToDataTable

Find starter help here:
GroupBy_1Col_FilterMembers-WhenCheckOK.xaml (7.1 KB)

About LINQ and GroupBy have a look here:
[HowTo] LINQ (VB.Net) Learning Catalogue - Help / Something Else - UiPath Community Forum

try this solution

Sequence.xaml (10.2 KB)

1 Like

@mohdrahimi.adnan

  1. Read the excel file need to filter
  2. Use “Filter Data table” activity, pass the inputdt var, and output dt var, refer image
  3. write into excel you need
    image

Hi All, I manage to solve it by using RemoveDataRow Activity if previous row contain “not found” before using adding new row.

Thanks All