For Each Row () - reverse option?<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />The answer is probably no, but I thought I'd ask anyways
Question: is there any way to make For Each Row() go in reverse (from bottom to top)? Like --
It works slick and fast, but of course it's working top to bottom. I need to delete some rows and one always wants to do this in reverse of course.
thanks, DJ
Re: For Each Row () - reverse option?hi djhanson ,
Philip Brown is write. his method is not only faster but more reliable.
regarding the reverse way, you can try this option:
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
For( i = N Rows( dt ), 1 >= 1, i--,
dt << select where( Row() == i );
dt << delete rows;
Wait( 1.5 );
);
best,
ron
Re: For Each Row () - reverse option?Hi Phil, great idea! that looks even better - I will give it a try. cheers, DJ
Re: For Each Row () - reverse option?I wouldn't use For Each Row() to delete rows. I think an even faster method would be to use DeleteRows. For example, if one wanted to delete rows where Column(1) has missing values, one could do the following:
dt = current data table();
rowsToDelete = dt << Get Rows Where( Is Missing(:Column 1[]) );
If( NRows( rowsToDelete ) != 0,
dt << Delete Rows( rowsToDelete );
);
You can supply the conditional clause you'd need within the Get Rows Where().
Hope this helps!
Best,
Phil