Check data table variable for unique entries

hey everyone,

i got a data table variable with 3 columns (name, age, height). now i want to check if there are at least 2 people who got the same name (i.e. not alle name entries are unique). is there an easy way to do this?


Hi @muehlbauer157

Can you share the sample input and expected Output?


How about the following expression?

dt.AsEnumerable.GroupBy(Function(r) r("name").ToString).Where(Function(g) g.Count>1).Count

This returns 2 when input is as the following.



1 Like

Hi @muehlbauer157

dt.AsEnumerable().GroupBy(Function(row) row.Field(Of String)("Name")).Any(Function(g) g.Count() > 1)
1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.