Filter particular column only numeric and remove Empty row

i have excel file in that Particular Column Name is Assignment column have to filter

  1. filter only numeric values
    2.remove empty row
  2. save into new sheet


How to do it ? can any one help ?
Filter.xlsx (9.2 KB)

1 Like


Hope this expression would help you resolve this

dt = dt.AsEnumerable().Where(Function(a) Isnumeric(a.Field(of String)(“Assignment”).ToString) AND NOT String.IsNullOrEmpty(a.Field(Of String)(“Assignemnt”).ToString.Trim)).CopyToDatatable()

Cheers @Anand_Designer

in Addition to

Use a LINQ within assign activity
left: Result | Datatype: List(Of Datarow)

(From d in dtData.AsEnumerable
Let v = d("Assignment")
Where Not ( isNothing(v) OrElse String.IsNullorEmpty(v.toString.Trim) )
Where Regex.IsMatch(v.ToString, "^\d+$")
Select r = d).toList

then check within an if acitvity
Result.Count > 0
Then: dtResult = Result.CopyToDataTable
Else: dtResult = dtData.Clone

We do use this defensive approach as an empty filter result let CopyToDataTable will throw an Exception. So we use the copytodatable only when the filter result has some rows

Ensure following:

Getting Error used DT As datatable variable

can you give example

You didn’t close after .ToString while checking Isnumeric

Exactly here

Check this expression again

Cheers @Anand_Designer

have a look above on the detailed description

still getting error

FilterAsiignment.xaml (6.9 KB)

find starter help:
FilterAsiignment_V2.xaml (8.3 KB)

@ppr Thank you for given a solution

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