Knowing if some values have a double in a specific column of datatable

Hello UIPATH community,

I am looking for a way to check that the non-null values of my (database) column are represented at least twice in this same column.

if a value is alone in the column, a boolean turn true.

here is an exemple of a good column :

1
1
1
2
null
2
null
null
2
3
3
3
4
null
4

Can anyone help me ?

give a try on following

Assign Activity:
LHS: CheckResult | Boolean
RHS

(From d in yourDataTableVar.AsEnumerable
Where Not IsNothing(d(YourColNameOrIndex))
Where Double.TryParse(d(YourColNameOrIndex).toString.Trim, nothing)
Group d by k=d(YourColNameOrIndex).toString.Trim into grp=Group
Select c= grp.Count > 1).All(Function (x) x)

it will filter out all nulls or non parseable values and will return true if all values are occuring more then 1 time

Set1:
grafik

Set 2:
grafik

Find starter help here:
Check_1Col_DistinctValueOccursMoreThenX_FilterOutNullsNonParseables.xaml (7.0 KB)

In case of reinterpretating the requirement and let also count non digit values, but not null or empty values, we can modify the LINQ to:

(From d In dtData.AsEnumerable
Where Not IsNothing(d(0))
Where Not String.IsNullOrEmpty(d(0).toString.Trim)
Group d By k=d(0).toString.Trim Into grp=Group
Select c= grp.Count > 1).All(Function (x) x)

seems to be a good solution PPR Peter, thanks for your help btw, but this code don’t work in my deprecated version of UIPATH sadly …
I get the error : AsEnumerable is not a member of System.Data.DataTable.

I will try to find a solution to update this package but it’s always a hard time at work to ask for an update …

@hubert_leleu

For that issue check below post

This will help you

Thanks

Ok thanks for the help with this first issue, sadly it’s still not working.
The new error message is : Option Strict On disallows late binding .
it concern all the code you ask me to write …

(I hope this is the right translation in english)

@hubert_leleu

As you have deprecated version, that’s the reason to include that code into your xaml

This was fixed in the later versions of the UiPath

Thanks

yes it actually worked, there is no more error about AsEnumerable thanks to this code in the .xaml but the new error is about the entire function.

please show your implementation details (e.g. screenshot) and the validation message details. Thanks