Using variables to specify scale<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />Instead of using constants to specify the scale in a plot, I want to use variables to do so.
This section of code works
Dispatch(
{},
"1",
ScaleBox,
{Min( mn ), Max( mx ), Inc( mi ), Minor Ticks( nminor ),
Add Ref Line( mr, Solid, "Black" ), Show Major Grid( nmaj )}
)
However, I'm unable to specify Scale ( "Log" ) using a variable.
This section of code does not work
Dispatch(
{},
"1",
ScaleBox,
{Scale( ms ), Min( mn ), Max( mx ), Inc( mi ), Minor Ticks( nminor ),
Add Ref Line( mr, Solid, "Black" ), Show Major Grid( nmaj )}
)
where ms="Log"
suggestions appreciated
Using variables to specify scaleThere are some places where JMP (unfortunately) only accepts a literal value, not a variable. The ugly work-around is to use JMP meta-programming features like Substitute(). For example:
ms = "Log";
cmd = Substitute(Expr(Dispatch(
{},
"1",
ScaleBox,
{Scale( SCALEVALUE ), Min( mn ), Max( mx ), Inc( mi ), Minor Ticks( nminor ),
Add Ref Line( mr, Solid, "Black" ), Show Major Grid( nmaj )}
)), Expr(SCALEVALUE ), ms);
Eval(cmd); // if you had a complete expression
Substitute() is replacing the token SCALEVALUE with the value of ms.
Eval Insert() is another option but works on strings instead of expressions, so you'll have to Parse() the string before calling Eval().