Filter datatable by blanks

@NiranjanKN

  1. First read the data from input file and assign it to one DataTable variable and say ‘yourDT’.

  2. And then use below expression to filter DataTable based on blank columns in that DataTable.

         filterDT = yourDT.AsEnumerable().Where(Function(row) row("MSTA").Tostring.Trim = ''").CopyToDataTable
    
1 Like

hey @NiranjanKN,

I’m trying, how to use Not Equal to in filter options of filter table activity.
But there’s an alternate option, which is recording a macro in excel and use it by using Invoke VBA activity
here’s the Example code,

Sub Macro1()

    ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=5, Criteria1:= _
        "<>A2", Operator:=xlAnd
End Sub

This worked well.
but, as you can see I’ve used “<>A2” but while using <> in filter option it’s giving error.

So using recording macro by clicking on,

  1. column filter.
  2. text filters.
  3. Does Not Equal to
    and then give value as A2, click OK.

So this could be alternate option. :slightly_smiling_face:

@ NiranjanKN Hi,

Ex from your excel → row(2).toString = YourString
or u can use like
IF
String.isNullorEmpty(YourString)
Then → Will pass
Else → Will perform what you whant

GL with your project

Thank you.

1 Like

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