How to delete a row in a data table if row has any empty cells in it

Here in my data table I want to remove 1st, 3rd and 4th rows as the rows are having empty cells. How to do that. Please help.

Hi @Abhi15
you can use select as Datatable.Select(“[Column3] is null”) = Datarow
(type as datarow) now use for each activity to loop through the datarow , inside for each use remove data row activty.

1 Like

Hi @Abhi15

Please Try this

dtTable - datatable

dtTable = dtTable.AsEnumerable.where(Function(row) row.ItemArray.All(function(col) not string.IsNullOrEmpty(col.ToString))).CopyToDataTable

Thanks

4 Likes

Hi ,
You can as well use Filter datatable activity on empty columns to get rid of those rows.

Thanks,
Geetishree Rao

1 Like

Hi prasath

The above code is working fine.
Can you explain me the above code, looks like it is vb.net. I’m new to uipath and don’t know vb.net

Thanks.

@Abhi15 It is Linq query. The query is iterating through each row in data table (AsEnumerable). In each row it is checking if each column value is not null. The entire output is copied to data table (copytodatatable) and assinged to data table dtTable.

2 Likes

@Abhi15 what @MEHER_BJ is correct, thanks for explaining…

Thankyou @prasath_S and @MEHER_BJ .

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