Here is a list of tricks to make a JSL expression work:
Expression Handling in JMP: Tipps and Trapdoors
Hints:
- most of the platforms accept the column name (= string, "Flight") in addition the column name (=reference, :Flight)
so the only trick that we need: get the variable replaced by the column name (string).
The problem: for most of the cases Jmp doesn't evaluate an argument before calling the function.So, if you put Eval()around the function argument, it won't help to evaluate it.
-> Wrap everything in an Eval(Eval Expr(()) and replace your Eval()s with Expr()s
... to tell Jmp to evaluate them first.
capability_chart = function({variable, low, up},
Eval Expr(Process Capability(
Process Variables( Expr(variable), // select column for data
Spec Limits( Expr(variable)(LSL( low ), /*Target( 30 ),*/ USL( up )) ),
Individual Detail Reports( 1 ),
Capability Box Plots( 0 ),
Goal Plot( 0 ),
Capability Index Plot( 0 ),
Process Performance Plot( 0 ) // hide unnecessary info
))
));
capability_chart("Flight", 0, 10)
but the Spec Limits("Flight"(LSL( low ), Target( . ), USL( up )) ) doesn't work, it is converted to
Spec Limits( :Flight << {LSL( low ), Target( .), USL( up )} )
So, let's try the trick with Name Expr(As column(column name)):
Spec Limits(Expr(Name Expr(As column(variable)))(LSL( low ), Target( .), USL( up )) ),
... and again, we get:
Spec Limits( :Flight << {LSL( low ), Target( .), USL( up )} )
wow! ... and arg!
So, let's use Plan B: which always works: use Eval(Substitute())
The original idea: in combination with Name Expr(As column(column_name))as the replacement expression
... but almost surprisingly, it even works with the bare string (!):
capability_chart = function({variable, low, up},
Eval(Substitute(Expr(Process Capability(
Process Variables( _var_ ), // select column for data
Spec Limits( _var_(LSL( low ), /*Target( 30 ),*/ USL( up )) ),
Individual Detail Reports( 1 ),
Capability Box Plots( 0 ),
Goal Plot( 0 ),
Capability Index Plot( 0 ),
Process Performance Plot( 0 ) // hide unnecessary info
)),Expr(_var_), variable
)));
capability_chart("Flight", 0, 10)