cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.
  • JMP will suspend normal business operations for our Rest and Recharge Day on Friday, October 2, 2026.
    Regular business hours will resume on Monday, October 5, 2026.

Discussions

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

How to use a column reference inside a formula inside of a column formula?

If I have a column reference stored as a variable, call it clbColumn, how can I use this column for a given data table inside a function which is inside of a formula for a new column.

<JSL>

dt << New Column("Actual Timepoint", Numeric, Continuous, Formula(Date Difference(clbColumn, clbColumn2 "day") / 30.417));

<JSL>

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to use a column reference inside a formula inside of a column formula?

Insert one expression into another using Eval Insert, Eval Expr, Parse, and Substitute 

You will have to evaluate the references. Here is one example

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

col1 = "height";
col2 = "weight";

Eval(Substitute(
	Expr(dt << New Column("Mult", Numeric, Continuous, Formula(
		_col1_ * _col2_
	))),
	Expr(_col1_), Name Expr(AsColumn(dt, col1)),
	Expr(_col2_), Name Expr(AsColumn(dt, col2)),
));
-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: How to use a column reference inside a formula inside of a column formula?

Insert one expression into another using Eval Insert, Eval Expr, Parse, and Substitute 

You will have to evaluate the references. Here is one example

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

col1 = "height";
col2 = "weight";

Eval(Substitute(
	Expr(dt << New Column("Mult", Numeric, Continuous, Formula(
		_col1_ * _col2_
	))),
	Expr(_col1_), Name Expr(AsColumn(dt, col1)),
	Expr(_col2_), Name Expr(AsColumn(dt, col2)),
));
-Jarmo

Recommended Articles