cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Heinrich
Level II

Reorder source table columns - from Data Table Columns Viewer

Dear all, 

In the Data Table Colums Viewer there is the table Summary Statistics and in the red triangle menu i can select the command Reorder source table columns. My question is how can I run this command in a script? 

Thanks for any ideas.. 

 

2 REPLIES 2
txnelson
Super User

Re: Reorder source table columns - from Data Table Columns Viewer

The Column Viewer option "Sort By Name" only sorts an internal list of the column names.  It does not change the order of the columns in the data table.  It does change the order of the statistical output, for any Show Summary requests that are made after a "Sort By Name" has been selected.

To do a similar item in JSL, the below example would be one way to accomplish it.

names default to here(1);
dt=open("$SAMPLE_DATA/big class.jmp");

myColList = dt << get column names();

myColList = sortlist(myColList);

dt << summary( n(eval(myColList)));
Jim
Heinrich
Level II

Re: Reorder source table columns - from Data Table Columns Viewer

Thanks for the answer.

However i would like to sort the columns in the source table according to the amount N in Summary Statistics. 

 

Here is my script so far. 

 

Names Default To Here( 1 );
dt = Current Data Table();

Main Menu( "columns viewer" );

w = Window("Data Table Columns Viewer");
w[ButtonBox(1)] << Click;
w[ButtonBox(3)] << Click;
w[Table Box (1)] << Sort By Column ("N");

And then I would like to send this reorder command.

 

2023-03-20 17_10_16-Window.jpg

2023-03-20 17_08_14-Clipboard.jpg