For an open data table, what is the JSL equivalent to Cols>> Column Names>>Move Up ?
(cannot see the script in the log when I do this interactively)
I need to make the first row of my data table as header (via JSL). I am on JMP 16.
This might be too simple
Main Menu( "Move Up" );
Main Menu executes commands from the main menu.
Here is one way to do this
Names Default To Here( 1 ); dt = Current Data Table(); colNameList = dt << get column names( string ); For Each( {col}, colNameList, Column( col ) << set name( Char( As Column( col )[1] ) ) ); dt << delete rows(1);
There is also << Move Up (added in JMP16 and JMP17 scripting index has information what it really does) message which can be sent to datatable
@jthi . Do not see this example in JMP 16.2.0 scripting index.
Also,
dt<< Move up;
does not seem to work in 16.2.0.
My earlier post had snippet from JMP 17.2 Scripting Index. This is from my JMP (Pro) 16.2
But the command doesn't seem to work, so I would suggest using the Main Menu option. One thing to be careful with is that Move Up will affect current data table and the main menu() doesn't seem to obey optional <window name> argument properly. So it might be a good idea to force Current Data Table() before running the command
Names Default To Here(1); dt = Open("$SAMPLE_DATA/Big Class.jmp"); dt1 = Open("$SAMPLE_DATA/Iris.jmp"); Current Data Table(dt1); Eval(EvalExpr( Main Menu("Cols:Move Up", Expr((dt << get name))); )); wait(1); Current Data Table(dt); Main Menu("Cols:Move Up", "Big Class");
Big Class should have its column titles changed twice, but for some reason both tables get them changed once.