How to check if the components of a column in Data table are different?

Hello,

I have a data table consisted of 1 column, for instance:

"Column 1
43

3
0

43

12"

I would like to check if the components from the first 5 rows are different (43, null, 3, 0, null). I dont want to take into account the null values, so in this example the boolean value should be TRUE (they are different).

Thanks a lot.

Hello @pal1910

Try this

dt = dtcomponents.default.totable(true, “Column1”)

if dt.rows.count > 1 and dtcomponents.rows.count > dt.rows.count then

boolean = true

else

boolean = false

End if

Thank you very much.

What about if I want to do the same with a list of strings?

Thanks a lot my friend.

Hello @pal1910

See example below:

lst = New List(Of String)(New String(){“a”, “b”, “c”, “d”, “b”})

lstnew = (From d In lst Select d).Distinct().tolist

if lstNew.Count > 1 and lst.Count > lstNew.Count then

boolean = true

else

boolean = false

End if