Is it Possible to Remove Rows Using : GroupBy, Dictionary and LINQ?

Dears,

I have build one workflow to remove rows which are empty as follows:

1- Read Range
image

2- Filter DataTable

3- Write Range
image

But it’s execution is taking too much time because I have more than 100 Rows … Is it Possible to Remove Rows Using : GroupBy, Dictionary and LINQ or any other fastest Method ?

Thanks in Advance

currently it looks like rows where the pay column value is empty will be removed. But in the text it is mentioned “special word”. What is needed?

Removing datarows we can do by filtering as mentioned here:

1 Like

Thanks @ppr for quick reply and noticing the “Special Word”, I’ve updated the text :slight_smile: … I will try those shared 4 Methods

Hi @hsendel ,
You can use dt.AsEnumerable.Where(function(x) not string.IsNullOrEmpty(x(“Column Name”).ToString)).CopyToDataTable
This will give you the desired output

1 Like

For a defensive and strict filtering on the rows with a non blank column we can do:

Variables:

Filtering:
grafik

As CopyToDataTable will throw an execption for an empty filter result we avoid this by checking the returned result in advance:
grafik

1 Like

Dear @ppr , I will implement the same and update you.

Hi @vishal.kp
Thanks for your feedback, I will check this and update you.

1 Like

Outputdt=Dt1.asenumerable.where(Function(x) x(“Pay”).tostring.trim<>"").CopyToDataTable

Using this LINQ method you can achieve this

1 Like

Try this and let me know if you face any issue.
RemoveBlankRows.xaml (5.3 KB)

1 Like

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