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?

regards

Hi @muehlbauer157

Can you share the sample input and expected Output?

Hi,

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.

image

Regards,

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.