Publication date: 10/01/2019

Formulas

The message Suppress Formula Eval takes a Boolean argument to specify whether formula evaluation should be suppressed or not. You might want to suppress evaluation if you plan to make numerous changes to the data table and do not want to wait for formula updates between steps.

dt << Suppress Formula Eval( 1 );
dt << Suppress Formula Eval( 0 ) ;

To accomplish the same effect for all data tables, use the Suppress Formula Eval command to turn off formulas globally. This is the same as the message above, except that you do not send it to a data table object.

Suppress Formula Eval( 1 ); // make formulas static globally
Suppress Formula Eval( 0 ); // make formulas dynamic globally

Note that formulas are not evaluated when they are installed in the column. Even when you force evaluation, they end up being evaluated again in the background. This can be a problem for scripts if they depend on the column having the values while the script is running. If you need a mechanism to control evaluation, use the EvalFormula command or the Run Formulas command.

To force a single column to evaluate, send an Eval Formula command to the column. You can even do this inside the command to create the column, after the formula clause, as follows:

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << New Column( "Ratio",
	Numeric,
	Formula( :height / :weight ),
	Eval Formula
);

dt << Run Formulas performs all pending formula evaluations, including evaluations that are pending as a result of evaluating other formulas. This function is useful when you have a whole series of columns to run.

Tip: This method is preferred over EvalFormula. Although EvalFormula evaluates the formulas, it does not suppress the background task from evaluating them again. The background task takes great care to evaluate the formulas in the right order.

If you send the Run Formulas command to a data column, the evaluation is done at the time of the command, but it does not suppress the scheduled evaluations that are pending. Therefore, formulas might end up being evaluated twice if you also send the command to the data table and the data column. Being evaluated twice might be desirable for formulas that have random function in them, or it might be undesirable if they depend on randomization seeds being set. If you use random numbers and use the Random Reset(seed) feature to make a replicable sequence, then use the Run Formulas command, because it avoids a second evaluation.

Note: All platforms send a Run Formulas command to the data table to assure that all formulas have finished evaluating before analyses start.

Set Values without a Formula

col << Set Each Value(expression) evaluates the expression for each row of the data table and assigns the result to the column. It does not store the expression as a formula.

Want more information? Have questions? Get answers in the JMP User Community.