Row delete in DataTable

Hi,
I have create a datatable from screenscrapping, i want to remove some rows on the base of the length. And want the output as a datatable. Please let me know how can i achieve that.
Thank

Hello @Dany069

You can loop through the data table using a for each row activity and inside that use an if activity to check your desired condition and remove row appropriately something like -

If row(“Name”).ToString.Length>20 then use activity Remove Data Row

Regards,
Rishabh.

The remove data row didn’t work in For each row.

What error are you getting?

There is no error but the datatable give the output as blank. There is no row write in the datatable

If possible can you show me some example so that i can relate the same

Hi @Dany069,

DataTable.Select("LEN([ColumnName]) > 5").CopyToDataTable()

2 Likes

Here you go @Dany069
I’m assuming here that we’re deleting a row if the length of item in column “ID” is less than 5.

test.xaml (6.6 KB)

@Rishabh_Lakhera Yes but after deleting the rows. I want another Data table to create with remaining rows.

Well in that case what @3726 said should work just fine :slight_smile:

thanks for your help @Rishabh_Lakhera and @3726 issue resolve

1 Like

Hi, how can i put a variable instead of having directly “5” in the compare?

Thanks a lot

@Stefano_Skjupyter
DataTable.Select("LEN([ColumnName]) > " + YourVariable.ToString).CopyToDataTable()

If it’s already a string variable you can leave out the .ToString portion

1 Like