cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
How to use a variable value in a formula

If you use a global variable in your column formula, the formula might function normally in your current session of JMP®, but when re-opening the application, the global variable will be nonexistent thus the formula will not evaluate properly.

Instead of using the variable directly in the formula, you should substitute the variable value in its place. The function, Eval Expr() can be used for this purpose.

Here is example code that uses the function to perform the task:

dt = Open( "$SAMPLE_DATA/big class.jmp" ); 
myConstant = 25;
Eval( Eval Expr( dt << New Column( "Weight Plus", numeric, continuous, Formula( :weight + Expr( myConstant ) ) ) ) );

 

[Previously JMP Note 41824]

Details
Operating System
macOS Windows
Products JMP JMP Pro