Hello everyone,
I come across a .Select method which I haven’t used so far and seems confusing to me.
MyDataTable.Select(“[Serial_Number]='”+ row(“Serial_Number”).ToString +“'”)
What does this method actually return?
Thanks in advance!
Hello everyone,
I come across a .Select method which I haven’t used so far and seems confusing to me.
MyDataTable.Select(“[Serial_Number]='”+ row(“Serial_Number”).ToString +“'”)
What does this method actually return?
Thanks in advance!
it tries to filter on a particular Serial_Number, but out of context we cannot analyze all and verifying its correctness. Maybe you can share a screenshot with us showing us more details of the implementation. Thanks
Docu
Syntax:
MyDataTable.Select(“[Serial_Number]=’”+ row(“Serial_Number”).ToString +“’”) is located within For Each row in MyDataTable.
Is there a possibility that a method I’m trying to understand is checking for duplicates in MyDataTable?
Hi @bp777
You can use below code to remove duplicates
MyDataTable.DefaultView.ToTable(true,"Col1","Col2",....)
Here true means distinct. If you only want to select some columns with redundant data you can use false and then column names.
Alternatively, you can use the Remove Duplicate Rows activity.
Thanks,
Prankur
Checking for duplicates can be done with different approaches. But first of all lets define the a duplicate:
Duplicate (all columns):
we can remove with
We can check with following:
https://forum.uipath.com/t/howto-find-duplicate-nonduplicate-rows-checking-all-columns-without-explicit-listing-the-colnames-index/222597/5
Getting Duplicates (e.g. 1 column):
Can be done with a group by
(From d in YourDataTableVar.AsEnumerable
Group d by k1=d(YourColNameOrIndex).toString.Trim into grp=Group
Where grp.Count > 1
Select g=grp).SelectMany(Function (x) x).CopyToDataTable
When changing the filter condition to Where grp.Count = 1
we will get the unique ones
I’m sorry for late response.
So, my DataTable looks like this
Serial Number
80976453
80968011
80970818
80961396
81131170
80965776
80971617
80963858
80963595
80963093
What result will be after MyDataTable.Select(“[Serial_Number]=’”+ row(“Serial_Number”).ToString +“’”)?