Hi Team,
I am having two data tables in First data table the column values of EMPID should be compared with second data table EMPID column values if there is any duplicate matching get the count and print the count
So, it seems you just want to know how many from the first table is also in the second table.
You can probably run the first table through a For Each loop, then calculate the matches.
I, personally, would probably use some .net to pull in the matches. A pseudocode for this would look like this:
If Not dt1.Columns.Contains("Count")
Add Data Column "Count"
For each row In dt1
Assign count = dt2.AsEnumerable.Where(Function(r2) r2("EmpID").ToString.Trim = row("EmpID").ToString.Trim).ToArray.Count
Assign row("Count") = count.ToString
Note: this is not actual code and just showing the activity logic needed in UiPath
When calculating the count, I was comparing the values as strings, so if you need to compare them as numbers which is common, you will need a slightly different condition to convert the values to numbers first.
New dt= (from p in dt.Select() where( From q in dt.Select() where string.Join(“,”,q.ItemArray).Equals(string.Join(“,”,p.ItemArray)) Select q).ToArray.Count>1 Select p).ToArray.CopyToDataTable()