Change Where filter in Graph BuilderIf I have created a chart with a Where() clause, how do I change that filter from a script?
I can do it with a local data filter, but can't seem to change the Where clause although I can read it using << Get Where Expr
Example:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = dt << Graph Builder(
Variables( X( :weight ), Y( :height ), Color( :sex ) ),
Elements( Points( X, Y, Legend( 3 ) ) ),
Where( :sex == "F" )
);
gb << get where expr; // outputs :sex == "F"
How do change gb to be restricted to :sex == "M" later in the script?
I'm using JMP 18.2.
Automation and ScriptingRe: Change Where filter in Graph BuilderI don't think you can change the Where expression in already created graph builder. If you wish to change those, you could use local data filter which is hidden and update the selections on that.
Re: Change Where filter in Graph BuilderIf it's OK to create a new graph, you can work with the script, replace the Where() expression with a new on and then evaluate the new code:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = dt << Graph Builder(
Variables( X( :weight ), Y( :height ), Color( :sex ) ),
Elements( Points( X, Y, Legend( 3 ) ) ),
Where( :sex == "F" )
);
script = gb << get script;
whereexpr= extract expr(script, Where(wildList()));
Substitute into (script, Name Expr(where expr), Expr(___W___));
<BR />// later:
new whereexpr = Expr(Where( :sex == "M" ));
Substitute into (script, Expr(___W___) , Name Expr(new whereexpr));
Eval(script)