How to switch Group X to display all items or only certain items?How to switch Group X to display all items or only certain items?
As shown in the JSL below, using Where can make Group X display only specific items. However, it is not possible to toggle between displaying all and displaying partial items. How should this be modified? Perhaps using add variable() is needed, but I cannot find how to use add where.
Names Default To Here( 1 );
selection = 1;
New Window( "Example",
cb = Combo Box( {"Only age 13 and 16", "All age"}, selection = (cb << Get()) ),
Button Box( "Plot",
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = dt << Graph Builder(
Size( 528, 500 ),
Show Control Panel( 0 ),
Variables( X( :sex ), X( :age, Position( 1 ) ), Y( :height ), Group X( :age ) ),
Elements( Points( X( 1 ), X( 2 ), Y, Legend( 10 ) ) ),
If( selection == 1,
Where( Contains( {13, 16}, :age ) ),
),
);
)
);Automation and ScriptingRe: How to switch Group X to display all items or only certain items?You have multiple different options:
- have two separate graph builder expressions
- use (hidden) local data filter
- build the graph builder expression with Where
- use linked subset (which is filtered using your conditions) for the graph builder
Here is one way of using Where
Names Default To Here(1);
selection = 1;
New Window("Example",
cb = Combo Box({"Only age 13 and 16", "All age"}, selection = (cb << Get())),
Button Box("Plot",
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb_expr = Expr(Graph Builder(
Size(528, 500),
Show Control Panel(0),
Variables(X(:sex), X(:age, Position(1)), Y(:height), Group X(:age)),
Elements(Points(X(1), X(2), Y, Legend(10)))
));
If(selection == 1,
Insert Into(gb_expr, NameExpr(Where(Contains({13, 16}, :age))));
);
gb = Eval(EvalExpr(Send(dt, Expr(gb_expr))));
)
);