How to count the number of blank items in a datatable?

Hello everyone,

Greetings of the day.

I need help with filtered out rows which has empty values in it?

Lets say input datatable contains Name EmpID PhoneNumber
1 Steve 12345 999999999

  1. Mark    12347  999999998

So here that second row has nothing.
I want to filter out that row completely and get datatable with two rows which has values.

Please help me out asap.
Thank you in advance


You can use Filter Datatable activity and define your logic as below


Like that you can define more condition by clicking + button

Hope this will help you


1 Like


If you want to delete the empty rows considering the whole DATATABLE then

DataTableName=DataTableName.Rows.Cast(Of DataRow)().Where(Function(row) Not row.ItemArray.All(Function(field) field Is DBNull.Value Or field.Equals(""))).CopyToDataTable()


If you want to delete empty rows based on one column

DatatableName = DataTableName.Select("Convert(column3, System.String)< >''").CopyToDataTable()
Datatablename = DataTableName.Select("column3< >''").CopyToDataTable()

Cheers @Pruthvi.G


have a look here:

1 Like

Hi @Pruthvi.G

Try this expression

(From r in DtMaster.Rows.Cast(Of DataRow)().Where(Function(r) Not r.ItemArray.All(Function(field) field Is DBNull.Value Or field.Equals("")))).CopyToDataTable()


1 Like

I am sorry… I think I did not put the exact requirement in my original question. I have a datatable in which few columns have blank values. I just want to know if any of the column values contains string or not. Or is there a way to count the number of blank values in the datatable.


Consider the above scenario where in the second row few columns are empty, when I read that row I want to check if it contains a string or not.

find starter help here:
Check_dtHasBlanksInAnyCol.xaml (6.9 KB)

1 Like

Thank you for the prompt reply.

Is there a way to check if it contains string?

or count the number of blanks?

Hi @Pruthvi.G

Use For each row in DT

Use If activity




elaborate more on it, as we can interpret in many directions

Count of all empty cols
CountBlankCols_dtHasBlanksInAnyCol.xaml (7.7 KB)

1 Like


1 Like

Any further queries on this topic @Pruthvi.G

@ppr Thank you for the prompt reply

I just want to check if the value in the cell is string. String value could be anything, I am not looking for any certain string, need to check if value in the cell is a string or not

when counting the blanks and rows Count * Col Count = No Of All Columns we can calculate the filled Columns

As mentioned about the different interpetations, we would recommend that the definition of your focused target should be very clear and detailed

e.g. 123 number could be counted as string
e.g ABC Letters could be counted as string
e.g. ABC123 could not be counted as string, with a definition of only letters

A column value like d(“ColName”).toString.Length > 0 would not serve as for complex datatype the output would be the datatype name and would confuse the counting.

So as mentioned above. Please give us clear, reliable and sharp definition and requirement description on what you are looking for. We had provided several suggestions. The topic title not matching your need etc. we can faster help when you come across with the clear requirement (e.g. sample data along with expected output description) Thanks for support.

Sorry for being not clear in my question.

The above Xaml helped in resolving the issue.

Thank you so much for your time.
You’re Awesome!!

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