Remove rows in datatable that doesn't match a certain criteria

Hi all,

I’m trying to run through a datatable with a “for each row” loop, and then delete the rows that don’t meet a certain criteria. The criteria to be met is that the row needs to contains the string “was posted in”.

This is how my loop looks like:

My question is what I should Write in the “Row” or “RowIndex” Properties field in order to remove that certain row that doesn’t contain the string mentioned above.
remove_data_row2

I have been looking for a while in the forum, but couldn’t find any similar cases.

All help is appreciated.

Kind regards,
Jakob

You can’t remove a row while in a loop. Instead build a datatable and add data to that table or else use datatable select which would be more smart solution

Thanks,
Prankur

Hi,
Try below code
Dt=Dt.select("Message like '%was posted in%'").CopyToDataTable()

Regards,
Arivu

Hi @PrankurJoshi and @arivu96 ,

Thank you for the replies. I figured out that the “Filter Data Table” activity was the perfect way to solve this. If anyone else should have the same issue, here is how I sorted my table:

2018-11-22_15-37-53