Reconcile the duplication with uniq table

kindly let me know is there any way or LINQ code available, i can reconcile the two different table to fine match and unmatched
example table 1
|Name |age|
|kamal|30|
|suresh|20|
|bala|32|
|bala|32|

example table 2
|name|job|
|vimal|developer|
|sutha|BA|
|bala|PM|

after reconcile with both table’s name column expected output of table one matched result
|name|age|
|bala|32|

only one name was matched even that was duplicated. other one was to come in unmatched results like
|name |age|
|kamal|30|
|suresh|20|
|bala|32|

is there any way to make this possible normally i tried with LINQ and join table but its matching both duplicated name so most of the time its really hard to reconcile the duplicated values

Hi @yatharthan_riox ,

Welcome to UiPath Form :slight_smile:

(From p in dt.Select() where( From q in dt1.Select() where q("Name").Equals(p("name")) Select q).ToArray.Count>1 Select p).ToArray.CopyToDataTable()

(From p in dt.Select() where( From q in dt1.Select() where q("Name").Equals(p("name")) Select q).ToArray.Count=0 Select p).ToArray.CopyToDataTable()

Regards,
Arivu

Hi arivu

thank your response

i tried with your suggestion but the problem was still exist kindly refer below image i think it will give you better understanding of my problem

Here is the Solution,

Main Table:
MainTable

Input Table:
Input Table

Expected Output:
Immediate_SS

LinQ for Matched:
(
From row In dt_MainInput
Join main In dt_InputTable
On row(“Name”).ToString.Trim Equals main(“Name”).ToString.Trim
Select row
).CopyTODataTable().AsEnumerable().DistinctBy(Function(x) x(“Name”).ToString.Trim).CopyToDataTable

LinQ for UnMatched Data:
dt_MainInput.AsEnumerable().Except(dt_OutputMatched.AsEnumerable(),System.Data.DataRowComparer.Default).CopyToDataTable

Thank you,
If you have any queries then let me know.

Happy Automation :slight_smile:

thanks for the solution ,

if comparing with 2 columns how its comes ??

example - from table 1 columns - name and DOB , from table2 name and DOB

(
From row In dt_MainInput
Join main In dt_InputTable
On row(“Name”).ToString.Trim Equals main(“Name”).ToString.Trim And row(“DOB”).ToString.Trim Equals main(“DOB”).ToString.Trim
Select row
).CopyTODataTable().AsEnumerable().DistinctBy(Function(x) x(“Name”).ToString.Trim).CopyToDataTable

LinQ for UnMatched Data:
dt_MainInput.AsEnumerable().Except(dt_OutputMatched.AsEnumerable(),System.Data.DataRowComparer.Default).CopyToDataTable

You just have to add “And” then further condition as mentioned above…!(Matched Output LinQ)

thanks again ajay,

i faced another problem, like per your example your main_table containing 3 records of “bala” and input_table containing one “bala”

what if the input_table containing 2 no of records for “bala” in that case your solution only identifying the one record.

particularly for this is there any solution??