Subscribe Bookmark RSS Feed

Deleting two rows and repeating the rest of the data

daniel_harding

Community Trekker

Joined:

Jul 2, 2012

Hi,

I have a new column in my data table and using JSL,  I need to remove the first two rows of the column, move the remaining data up to the top of the column, and then repeat those values until the final row.  Attached with this question is what it looks like right now.

Thanks for any suggestions or help!

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

This should work for the example. Replace 'Column 1' with the column name of interest.

data_raw=currentdatatable();

data_table=data_raw<<subset(rows(

          data_raw<<getrowswhere(

               !ismissing(:Column 1)

               &row()!=1

               &row()!=2

          );

     ),

     invisible

);

data_rows=column(data_table,"Column 1")<<getasmatrix();

close(data_table,nosave);

For(i=1;k=1,i<=nrows(data_raw),i++;k++,

     column(data_raw,"Column 1")=data_rows;

     If(k==nrows(data_rows),k=0);

);

2 REPLIES
Solution

This should work for the example. Replace 'Column 1' with the column name of interest.

data_raw=currentdatatable();

data_table=data_raw<<subset(rows(

          data_raw<<getrowswhere(

               !ismissing(:Column 1)

               &row()!=1

               &row()!=2

          );

     ),

     invisible

);

data_rows=column(data_table,"Column 1")<<getasmatrix();

close(data_table,nosave);

For(i=1;k=1,i<=nrows(data_raw),i++;k++,

     column(data_raw,"Column 1")=data_rows;

     If(k==nrows(data_rows),k=0);

);

daniel_harding

Community Trekker

Joined:

Jul 2, 2012

That works perfectly. Thank you so much!