cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • DownloadSemiconductor Toolkit: Tools to create wafer maps, add wafer geometry to graphics, explore die defects & compare wafers.
  • Discovery Summit 2026: Early User Edition - September 23-24.Register. It's free.
  • See how to design an experiment, explore factor-response relationships, assess tradeoffs, and ID best settings. Register for Sep. 11 Mastering JMP.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
PowerOx327
Level II

How do I manipulate column formulae in data tables by scripting?

Hi, 

 

I'm trying to add a formula to convert values in a selected column through scripting without having to add any new columns in the data table, is there a way to edit formulas for a column by scripting? For example I'm trying to set the height column in this data table to be halved when I run the script:

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
Current Data Table() << Get Column Names;
height = height/2;
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How do I manipulate column formulae in data tables by scripting?

Your specified formula is recursive when used as a column formula.  A column formula will run whenever it detects a change in the column.

What you are suggesting can simply be done in open JSL.

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
Current Data Table() << Get Column Names;
height = height/2;

or

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
For( i = 1, i <= N Rows( current data table() ), i++,
	:height[i] = :height[i] / 2
);

or

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt:Height << set values( dt[0, 4] / 2 );

If the formula isn't recursive, one can set the column formula by using the Set Formula message

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
Current Data Table() << Get Column Names;
:height << set formula(:weight/2);

I strongly suggest that you take the time to read the Scripting Guide available in the JMP Documentation Library under the Help pull down menu

Jim

View solution in original post

2 REPLIES 2

Re: How do I manipulate column formulae in data tables by scripting?

A data column formula is just a JSL expression that is evaluated row-wise. You can use the data column messages << Get Formula() and << Set Formula(). Use expression functions to access and modify the expressions as needed.

txnelson
Super User

Re: How do I manipulate column formulae in data tables by scripting?

Your specified formula is recursive when used as a column formula.  A column formula will run whenever it detects a change in the column.

What you are suggesting can simply be done in open JSL.

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
Current Data Table() << Get Column Names;
height = height/2;

or

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
For( i = 1, i <= N Rows( current data table() ), i++,
	:height[i] = :height[i] / 2
);

or

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt:Height << set values( dt[0, 4] / 2 );

If the formula isn't recursive, one can set the column formula by using the Set Formula message

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
Current Data Table() << Get Column Names;
:height << set formula(:weight/2);

I strongly suggest that you take the time to read the Scripting Guide available in the JMP Documentation Library under the Help pull down menu

Jim

Recommended Articles