passing a variable into a cusum chartHi there,
In the simple script below, how do I pass the variables varTarget and varSigma into the cusum creation?
dt = Open( "$SAMPLE_DATA/Quality Control/Engine Temperature Sensor.jmp" );
varTarget = 100;
varSigma = 10;
dt << CUSUM Control Chart(
Y( :Y ),
Target( varTarget),
Sigma( varSigma ),
SendToReport(
Dispatch(
{"CUSUM Chart"},
"2",
ScaleBox,
{Min( -7.5 ), Max( 10 ), Inc( 5 ), Minor Ticks( 1 )}
)
)
);
ScriptingRe: Passing a variable into a cusum chartI thought that I could use Eval Expr() function with the variables as arguments but it didn't work here. Anyway, I usually use this approach based on substituting parts of an expression.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Quality Control/Engine Temperature Sensor.jmp" );
varTarget = 100;
varSigma = 10;
Eval(
Substitute(
Expr(
dt << CUSUM Control Chart(
Y( :Y ),
Target( ttt ),
Sigma( sss ),
SendToReport(
Dispatch( {"CUSUM Chart"}, "2", ScaleBox, {Min( -7.5 ), Max( 10 ), Inc( 5 ), Minor Ticks( 1 )} )
)
)
),
Expr( ttt ), varTarget,
Expr( sss ), varSigma
)
);Re: Passing a variable into a cusum chartHere is how to do it with Eval Expr:
Eval(Eval Expr(
dt << CUSUM Control Chart(
Y( :Y ),
Target( Expr( varTarget ) ),
Sigma( Expr( varSigma ) ),
SendToReport(
Dispatch( {"CUSUM Chart"}, "2", ScaleBox, {Min( -7.5 ), Max( 10 ), Inc( 5 ), Minor Ticks( 1 )} )
)
)
));This link shows a few other methods to do the same thing.