How to check if a column in a data table has any values or not

How to check if a column in a data table has any values or not. I have tried the

  • dt.Select(“colname is null”)

  • Any() method

Need to check if the column has any values or is it empty before proceeding for each loop

dt.Select(“colname is null OR TRIM(colname)=''”)

1 Like

Hi @PD2
Dt.Select("columnname <> '' or columnname is not null")
LINQ
Dt.Rows.Cast(Of DataRow)().Where(Function(row) Not (row("columnname") Is DBNull.Value Or Convert.Tostring(row("columnname")).Trim.Equals(""))).CopyToDataTable()

Or

variable4.AsEnumerable.Where(Function(row) row("columnname") is DBNull.Value or Convert.Tostring(row("columnname")).Trim = "").CopyToDataTable

Regards,
Arivu

1 Like

Thank you @vvaidya and @arivu96 for the prompt help. It sure helped, really appreciate it.

very good solution, thanks

Where should I put these expressions? I can’t place them into decision activity because they are not Boolean