Hi,
I’ve a data table which contain multiple column but in “Account” column I’ve to check whether it contain any duplicate value or not, if it contain duplicate return as True otherwise False.
Thanks!
Hi,
I’ve a data table which contain multiple column but in “Account” column I’ve to check whether it contain any duplicate value or not, if it contain duplicate return as True otherwise False.
Thanks!
Assign activity
hasDuplicates | Boolean =
(From d in YourDataTableVar.AsEnumerable
Group d by k=d("ColName").toString.ToUpper.Trim into grp=Group
Where grp.Count > 1).Any()
Hi
Hope the below expression would help you
Use a assign activity
bool_output = If(dt.Rows.Count>dt.DefaultView.ToTable(True, “Account”).Rows.Count, True, False)
Here we are trying to have the actual datatable dt and datatable without duplicate records in column Account
And comparing the count
If the count is equal then no duplicate it give as false
If count is of actual datatable is greater than the one removed with duplicates then it has duplicate which means true
The value gets stored in boolean variable named bool_output
Cheers @subhamsinha055
if it contain duplicate return as True otherwise it will return as False
dt.AsEnumerable().
GroupBy(Function(row) row.Field(Of String)(“Account”)).
Any(Function(Group) Group.Count() > 1)
Hi,
You can try this
Assign
hasDuplicates = dataTable.AsEnumerable().GroupBy(Function(row) row(“Account”).ToString()).Any(Function(g) g.Count() > 1)
Try this-
Assign activity:
For Each Row activity:
If activity:
Expression: YourDataTable.AsEnumerable().Any(Function(row) row("Account").ToString = currentRow("Account").ToString)
Here, YourDataTable
should be replaced with the name of your DataTable variable, and currentRow
is the variable representing the current row in the For Each Row loop.
If the condition is True:
After the For Each Row loop:
Workflow is complete.
Thanks!!
Perfect, so the topic can be closed?
Forum FAQ - How to mark a post as a solution - News / Tutorials - UiPath Community Forum
yes that was solved.