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

What is the JSL equivalent of Cols>> Column Names>>Move Up ?

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.

Neo_0-1694709584989.png

 

When it's too good to be true, it's neither
1 ACCEPTED SOLUTION

Accepted Solutions
Byron_JMP
Staff

Re: What is the JSL equivalent of Cols>> Column Names>>Move Up ?

This might be too simple

 

Main Menu( "Move Up" );

Main Menu executes commands from the main menu.

JMP Systems Engineer, Health and Life Sciences (Pharma)

View solution in original post

5 REPLIES 5
txnelson
Super User

Re: What is the JSL equivalent of Cols>> Column Names>>Move Up ?

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);
Jim
Byron_JMP
Staff

Re: What is the JSL equivalent of Cols>> Column Names>>Move Up ?

This might be too simple

 

Main Menu( "Move Up" );

Main Menu executes commands from the main menu.

JMP Systems Engineer, Health and Life Sciences (Pharma)
jthi
Super User

Re: What is the JSL equivalent of Cols>> Column Names>>Move Up ?

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_0-1694760974370.png

 

-Jarmo
Neo
Neo
Level VI

Re: What is the JSL equivalent of Cols>> Column Names>>Move Up ?

@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.

When it's too good to be true, it's neither
jthi
Super User

Re: What is the JSL equivalent of Cols>> Column Names>>Move Up ?

My earlier post had snippet from JMP 17.2 Scripting Index. This is from my JMP (Pro) 16.2

jthi_0-1694767116279.png

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.

 

-Jarmo