cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
BabyDoragon
Level II

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 ) ),

			),

		);
	)
);
1 REPLY 1
jthi
Super User

Re: 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))));
	)
);
-Jarmo

Recommended Articles