cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar
DKI
DKI
Level II

Rename a column jsl script

Hi 

 

I am pretty new to JSL scripting. I cant seem to find a script to rename of a column header from one name to another

Appologies this is probably obvious to most here

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Rename a column jsl script

Here is an example from

     Help==>Scripting Index==>Data Table==>Column Scripting

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
:Age << Set Name( "Time" );

 

Jim

View solution in original post

5 REPLIES 5
txnelson
Super User

Re: Rename a column jsl script

Here is an example from

     Help==>Scripting Index==>Data Table==>Column Scripting

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
:Age << Set Name( "Time" );

 

Jim
DKI
DKI
Level II

Re: Rename a column jsl script

Thanks alot Jim

Thats exactly what I needed. I was using a variation on that script that I had been messing around with for ages and could not make it work. 

Thanks also for showing where you found it.

GreenisBTFL
Level I

Re: Rename a column jsl script

The script you suggest works well when a user is working with only one table.  But I've been trying to change the name of a specific column within one of several tables open, and cannot find guidance within the Scripting Index.  What would the JSL syntax be for this scenario?

Example

I am working with two tables (Cdt1 and Cdt2) and Cdt1 has a column with name "value" that I want to change to "Fault code"

I've tried to select the "value" column first before changing the name, but that didn't help.

 

Cdt1 << Select Columns("value");
Column("value") << Set Name( "Fault code" );

 

My other attempt was worse...

Cdt1 << Columns("value") << Set Name ("Fault code");

Either way, I haven't been successful after a while of trying and looking for guidance.  Any help would be appreciated.

 

Re: Rename a column jsl script

From the scripting index:

 

mmarchandFSLR_1-1750277617377.png
mmarchandFSLR_0-1750277582774.png

So your code should be:

 

Cdt1:value << Set Name( "Fault code" );

OR

 

Column( Cdt1, "value" ) << Set Name( "Fault code" );

 

Re: Rename a column jsl script

In the future, you might find the on-line help useful. In this case:

  1. Select Help > Scripting Index.
  2. Change the drop-down menu from initial All Categories to Objects.
  3. Select Column Scripting under Data Table in the first list.
  4. Select Set Name in the second list.

You will find the correct syntax with arguments and options. You can run an example and observe the result. You can click Topic Help to go to the more complete coverage in the main help system.

You can also search in Objects with column name for example to find all related functions or messages.

Recommended Articles