in this project I have duplicate data but the data is written in upper case in a few rows and lower case in other rows. So when I run the bot it removes the matching data, but leaves the cases sensitive data in there. Example; in column ADD1 the address is written with upper and lower cases. See pic.
Here is a screen of the application
hariapn
(Hari Kumar)
October 5, 2021, 11:47am
2
Hi @jeff.shubzda
You may try adding formula and change all lines to lower or upper case and then run the bot…
Hope bot will remove duplicate lines now…
Hello @jeff.shubzda
Try the below Linq for removing the duplicates:-
dataTable = dataTable.AsEnumerable()
.GroupBy(Function(i) i.Field(Of String)(“Add 1”))
.Select(Function(g) g.First)
.CopyToDataTable
Mark as a solution and like it if this helps you
Happy Automation
Best Regards
Er Pratik Wavhal
ppr
(Peter Preuss)
October 5, 2021, 12:50pm
4
With groupby as mentioned by Pratik we can handle it, but we have to harmonize it e.g toUpper cases
Assign Activity
left: dtDistinct | DataType: DataTable
rigth:
(From d in dtData.AsEnumerable
Group d by k=d("Add 1").toString.Trim.ToUpper into grp=Group
Select r = grp.First()).CopyToDataTable
Thanks for the response, I’m new to this stuff, raw like sushi, how or where do I inject this code within the workflow of my project? Would this be a multiple assign? Sorry for the rawness
ppr
(Peter Preuss)
October 5, 2021, 1:34pm
6
was written above: Assign activity
2 Likes
Hi @jeff.shubzda
First of all thanks @ppr for highlighting
I just missed the thing to add in my expression in a hurry which Peter highlighted.
The Updated expression is below:-
dt.AsEnumerable().GroupBy(Function(i) i.Field(Of String)(“Add 1”).Trim.ToUpper).Select(Function(g) g.First).CopyToDataTable
I have now just added “.Trim.ToUpper” in the existing expression. That’s it.
Output:-
Happy Automation
Best Regards
Er Pratik Wavhal
1 Like
system
(system)
Closed
October 8, 2021, 3:41pm
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.