DataTable filling up with random data after using Remove Data Row?

IDK If I’m going crazy from the lack of sleep or what but I’m new to UiPath and I have this datatable1 table that has 100+ rows but the after filtering, the new datatable has 66 rows

after doing my entire workflow I have a list of indexes that I must remove from the datatable, so I have this

the list “list_of_rows_to_be_deleted” is sorted in descending order.

However, at the end, when I take a look at my final product, there is still 66 rows? The weirdest thing is that okay, let’s say my list is [59, 57, 53, 38, 31, 28, 22, 16, 14, 13, 12, 5]. Once the limit runs out (e.g. 66 - 12 = 54 so after 54 rows) it just repeats the last 12 lines so it will always finish with 66 lines? And I can’t just use “remove duplicates” because due to some prior calculations some of the values are not the same. Not sure what I am doing wrong here, i can post my .xaml file but i cant post my excel sheet because of confidential information.

@Woon_El

What do you mean just repeats…

So you are saying wven after remove you are still having the same number of rows?

Did you try debugging using step into and locals panel to check if the for loop is working and all?

Cheers

Hi @Woon_El , if you loop over a list of index and remove rows off the same datatable, with every loop the row index will change. I understand your list of index is in descending order, which kind of avoiding the issue.

Instead of collecting index to list, add a column to the datatable with “keep” and “remove” as values per row. Then filter the datatable at the end using “keep” or “remove”, followed by removing the extra column that was added to facilitate filtering, giving you the final result.

@sudster @Anil_G sorry for the question, turns out I forgot to clear the excel sheet, so it was actually my previous data in there.

1 Like