Hi Team,
I have a two datatables as below
I want the names from table1 which are not present in Table2.
The expected output is Table3
I am looking for a linq query for the same.
Regards
Jeevan
Hi Team,
I have a two datatables as below
I want the names from table1 which are not present in Table2.
The expected output is Table3
I am looking for a linq query for the same.
Regards
Jeevan
You can try this.
Specific query would be like this:
table3= table1.AsEnumerable.Except(table2.AsEnumerable, System.Data.DataRowComparer.Default).CopyToDataTable
Thanks,
Ashok
when table3 also has to keep the empty lines, then you would have to handle more
When table3 is only about 3 Rows: Lakshman, Hanuman, Jambhavanth
we would sugest the following
Assign Activity:
dt3 = dt1.Clone
Assign Activity:
dt3 =
(from d in dt1.AsEnumerable
Let cn = d("ColAName").toString.Trim.ToUpper
Let chk = dt2.AsEnumerable().Any(Function (d2) d2("ColBName").toString.Trim.ToUpper.Equals(cn))
Where not chk
Select r = d).CopyToDataTable
Handling Empty Results:
[FirstAid] Handling of The source contains no DataRows exception - News / Tutorials - UiPath Community Forum
we made a defensive check on trimmed values and on UpperCase Base.
Feel free to adapt and control on how strict the compare is needed
what if i want to get all the other column values as well in table2 satisfying the above condition
In that case you will have to join the tables. That would be whole another topic. You can close this topic as you should have got the answer to your original query and raise new one for your latest query.
Thanks,
Ashok