How remove unwanted specific rows

Hello,

In below image there is the column name (Match Type) in that column i have to remove the Confirmed where it’s available in the column remove whole row only I need to keep probable match

Thanks

Hi @suraj_gaikwad

Assign activity:

dtData = dtData.AsEnumerable().Where(Function(row) row.Field(Of String)("Match Type") = "Confirmed").CopyToDataTable()

Hope it helps!!

@suraj_gaikwad

datatable.AsEnumerable.where(function(x) x(“Match Type”).tostring.trim.equals(“Probable”)).copytodatatable

or you can use filter datatatable activity

cheers

1 Like

Hi @suraj_gaikwad

NewDataTable = YourDataTable.AsEnumerable().Where(Function(row) row("Match Type") <> "Confirmed").CopyToDataTable()

1 Like

Hii @suraj_gaikwad

(From row In inputDataTable.AsEnumerable()
Where Not (row(“ColumnName”).ToString = “Confirmed”)
Select row).CopyToDataTable

3 Likes

Hi @suraj_gaikwad

You can try this use Invoke Code activity

Code:

' Assuming you have a DataTable named yourDataTable
Dim rowsToRemove As New List(Of DataRow)

For Each row As DataRow In DT.Rows
    If row("Match Type").ToString().Contains("Confirmed") Then
        rowsToRemove.Add(row)
    End If
Next

For Each row In rowsToRemove
    DT.Rows.Remove(row)
Next

Hope this helps!!

1 Like

@suraj_gaikwad

You can try above code it is working

I/P:

image

O/P:

image

Hope this helps!!

1 Like

Hi @suraj_gaikwad ,

Could you try with the Filter Datatable activity and check if it is able to get you the expected output ?

If not, we could move to the Linq Filter Expressions.

Also, Do note that we are manipulating the Datatable and hence the Modified Datatable needs to be written back to the Excel sheet(A New sheet if possible).

1 Like

HI @suraj_gaikwad

Simply you can Use FILTER DATATABLE activity

Regards
Gokul

1 Like

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