Hi ,
Is there a way to check if a column have duplicate values , then if it does return as YES or NO if does’nt have.
Thank you
Hi ,
Is there a way to check if a column have duplicate values , then if it does return as YES or NO if does’nt have.
Thank you
Assign Activity
hasDupsInCols | Boolean =
(From d in YourDataTableVar.AsEnumerable()
Group d by k = d("YourColName").toString.ToUpper.Trim into grp=Group
Where grp.Count > 1
Select k).Any()
find updated statement above
We also would suggest that you elaborate more on your case and share some sample data with us
Hi @StevenIsRobotOnline ,
Instead x(“UNIQUE”), use d(“UNIQUE”) as you have used row variable d in “from d in dt.asenumerable…”
its just some normal data table
and if there is any duplicate values in column B then it will return YES
we gave the statement above. When expected output is different, then we prefer sample data instead of textual statements.
=> Use the Read range workbook activity to read the excel and store in a datatable.
=> Take an assign activity and write the below LinQ query.
- Assign -> hasDuplicates As Boolean = YourDataTableVar.AsEnumerable().GroupBy(Function(row) row("ColumnName")).Any(Function(g) g.Count() > 1)
=> After assign take an If condition to check the hasDuplicates boolean value.
- Condition -> hadDuplicates = True
=> In then block give activity to return the value ‘YES’
=> In else block give activity to return the value ‘No’
Hope it helps!!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.