Check 2 Data Tables and output the different

dt1.AsEnumerable().Where(r >!dt2.AsEnumerable().Select(x=>x[“ID”]).ToList().Contains(r[“ID”])).ToList();

can some one correct this code is showing me an error .And this code should get the different between 2 data tables columns

Hi @Tharusha_Fernando

Check this

How To Find Common/Uncommon Rows Between Two Datatables – In UiPath – ExcelCult

Hope it helps you

Regards

Nived N :robot:

Happy Automation :relaxed::relaxed::relaxed::relaxed:

hy @NIVED_NAMBIAR
its working but i m looking compare between 2 data coloums only and get the diffrents
the above compare the full datatable

Thank you

Hi @Tharusha_Fernando

U mean to get unique rows between the datatables ?

hi @NIVED_NAMBIAR

No ,to get not unique values
Thank you

I am not clear with ur query

Can u explain with screenshot

Table1
-------------------------
ID  |   Name 
--------------------------
 1  |  A
 2  |  B
 3  |  C
--------------------------

Table2
-------------------------
ID  |   Name 
--------------------------
 1  |  A
 2  |  B
--------------------------
ResultTable
-------------------------
ID  |   Name 
--------------------------
 3  |  C
--------------------------

So u need uncommon rows between two datatables while comparing

Is it right @Tharusha_Fernando

@NIVED_NAMBIAR

Yes while comparing

Hi @Tharusha_Fernando

Then try this

dt_UnCommonRows = dt1.AsEnumerable().Except(dt2.AsEnumerable(),System.Data.DataRowComparer.Default).CopyToDataTable

hi @NIVED_NAMBIAR

i can use this code using code invoke but cannot figure out to to get the out put

DataTable TableC = TableA.AsEnumerable()
    .Where(ra =>  !TableB.AsEnumerable()
                        .Any(rb => rb.Field<int>("id") == ra.Field<int>("id")))
    .CopyToDataTable();


Hi @Tharusha_Fernando

Instead of invoke use assign activity for this buddy

hi @NIVED_NAMBIAR