Tana20
(Tana20)
November 23, 2020, 11:27pm
1
Hi All,
I want to retrieve duplicates based on the columns “Supplier”, “Invoice”, and “Code” in workbook Test.xlsm , remove them from Sheet1, and paste them to Sheet2.
I already know how to remove duplicate rows within a DT using the activity, but that is not the goal.
Example
Input:
Expected output:
This is what I have so far using Linq, but I didn’t figure out how to group by 3 columns, and I don’t know if there is another way to accomplish this task,
FindDuplicates.zip (81.1 KB)
Currently, it can group by 2 columns but not for 3:
Unfortunately, I cannot use non-official activities
Regards.
prasath17
(Guru)
November 24, 2020, 12:04am
2
@Tana20 - Please check this
Hello, i am trying to delete duplicate datarows from two different tables based on two columns. [example 11]
I have two data tables that look like the sample sheet above, where I want to delete the duplicates found based on both column C and column D. Is there a linq query that i can use to do this? Thanks in advance!
2 Likes
Tana20
(Tana20)
November 24, 2020, 12:32am
3
@prasath17 Thanks, it works!
1 Like
park363
(UncleDev)
November 24, 2020, 2:25am
4
This way works well too!
try it.
dt.AsEnumerable()
.GroupBy(r => (r["Supplier"],r["Code"],r["Invoce"]), r=> r)
.Where(r => r.Count() == 1)
.Select(r => r.ToArray()[0])
//.SelectMany(r => r)
.CopyToDataTable();
1 Like
@park363 - Have you tried your solution? Lamba expression doesn’t work in UiPath, we have to change it to Function(x) x something like this…
Hello,
I’ve noticed that when using an expression with a lambda expression, UIPath always prompts an error with the following message “Expression expected”.
1 Like
park363
(UncleDev)
November 25, 2020, 5:54am
6
upper code is c#.
as your comment, vb uses ‘Function(x) x’ for lambda.
system
(system)
Closed
November 28, 2020, 5:54am
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.