Comparing the two datatables for exception of common value

Hello!

I would like to do this with UiPath.
But I have no idea what to do…

  • There are two datatables(A, B)
  • I need to except the common value in Column1.
  • As a result, I want to receive datatable C

I already used the code below. As a result, I received only Column1. But I want to receive Column1 & Column2 like the datatable C.

(DatatableA.AsEnumerable.Except(DatatablaB.AsEnumerable,System.Data.DataRowComparer.Default).CopyToDataTable)

Datatable A

Column1 Column2
a 1
b 2

Datatable B

Column1
b
c

Datatable C

Column1 Column2
a 1

Can someone please teach me how to do this?

@k486kr
Welcome to the forum

dtResult =

(From d1 in dtDataA.AsEnumerable
Let c0 = d("Column1").toString.Trim
Where Not dtDataB.AsEnumerable.Any(Function (d2) d2("Column1").toString.Trim.Equals(c0))
Select r = d1).CopyToDatable

For handling empty results we can do:
:ambulance: :sos: [FirstAid] Handling of The source contains no DataRows exception - News / Tutorials - UiPath Community Forum