Question

How to delete specific rows in a Datatable ?

  • 18 January 2023
  • 3 replies
  • 60 views

Badge

For example : Here I need to delete rows contain “bbb” and “ccc”
 

The output should contain only rows with “aaa”

 


3 replies

Userlevel 7
Badge +12

Hi @sree 1855 ,

 

If you are using the Data Table package, there is an option called Delete row for this requirement. You just need to pass the Data Table variable and the Row Index number. Since you need to clear 2 different rows, you can repeat this process 2 times and provide the required Row index. 

 

Note: Row index is starting from 0.

 

 

I hope this will help.

Badge +3

I actually have the same question - write now I’m looping through each datatable row, evaluating one of the fields from my tablerow variable, and if the condition is met, calling ‘Delete Row’ - however  I’m unsure of how to provide the Delete Row action with the index of that current data row that just passed the condition (which might be the loop counter - 1 since I believe the table rows are zero indexed).  Thanks.

 

 

Userlevel 7
Badge +12

Hi @JustinK ,

 

You can use a counter variable inside the loop and an If condition to check whether the row is fulfilling your criteria or not and use the Delete Row action if not. You can pass the counter variable there as the row index.

 

I hope you get the logic.

Reply