Hi all,I have the below data table, I need some help to delete the zeros after the first zero for each stack of zeros. (which means that I want to delete the row wherever :SEEN [i] is zero and also :SEEN[i-1] is zero.
Thanks in advance
@Kian,
Try the following:
dt = Current Data Table(); // Get reference to the data table dt << New Column("Test",Numeric,Continuous,Formula(If(:SEEN[Row()] == 0 & :SEEN[Row()-1]==0,1,0))); dt << Select Where(:Test == 1); Wait(3); // For Demo dt << Delete Rows ;
All you need to do is to loop through the data table and find all of the rows that meet the qualifications you specified, capture that row number and then at the end, delete all of those rows.
Names Default To Here( 1 ); dt = Current Data Table(); theList = {}; For( i = 1, i <= N Rows( dt ), i++, If( :SEEN[i] == 0 & :SEEN[i - 1] == 0, Insert Into( theList, i ) ) ); dt << delete rows( theList );