cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
matth1
Level IV

Change Where filter in Graph Builder

If 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.

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Change Where filter in Graph Builder

I 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.

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Change Where filter in Graph Builder

I 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.

-Jarmo
hogi
Level XIII

Re: Change Where filter in Graph Builder

If 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___));

// later: new whereexpr = Expr(Where( :sex == "M" )); Substitute into (script, Expr(___W___) , Name Expr(new whereexpr)); Eval(script)

Recommended Articles