Remove last rows if not same as conditions

Good Evening!

How can read last rows values and delete rows if conditions is not match.
Please kindly help to advise!

When server output data is not completed and want to remove uncompleted rows.
I was highlighted with red color which I want to remove if not 6 NE’s values;

remove last rows

Hi @kaungset

You can use the filter datatable activity to remove the records that you dont want…

1 Like

hi @Lahiru.Fernando, Thank For Your Advice!

I want to remove records when latest time record value is not complete from total 6 NEs.
I picture show latest 02/02/2020 00:10:00 rows is coming out only 3 NEs values.
If like this condition i want to remove latest time value rows. (want to remove only 02/02/2020 00:10:00 rows).

I am not sure filter datatable can do or not. Thank You!

Oh okay… then we need to go in a different approach…

First you need to sort the datatable in descending order so that you get the latest time values to the first set of records.

Now add a new column to hold a status flag of records which you want to remove

Now you will need to loop through the datatable to check each records… you can use an if condition inside the for each row loop to check it.

If those are to be deleted, update the new column row in the datatable we added.

Row(“Status”) = “Delete”

After you have marked it with the records you want to delete, then you can use the filter datatable activity to filter the records

1 Like

@kaungset How do you understand which row needs to be removed, Is it just by the red Color or is there any other Value In the Excel Data that we can say by Observing that it needs to be removed?

1 Like

use remove data row activity


Hi, thank you everyone :smiley: !

I had try and success with the following method to detect the output data complete or not.

I read the last row number of excel and then check the column C of last NE Name is NE-06 or not. If NE-06 proceed the process.

If last NE Name is NE-05 delete last 5 rows.
If last NE Name is NE-04 delete last 4 rows.
If last NE Name is NE-03 delete last 3 rows.
If last NE Name is NE-02 delete last 2 rows.
If last NE Name is NE-01 delete last 1 rows.

@kaungset Well done. That Logic Should Work from the look of the Excel you have Showed us. Good Going :smile:

1 Like

good job… go ahead :+1:

1 Like

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