cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
See how to use to use Text Explorer to glean valuable information from text data at April 25 webinar.
Choose Language Hide Translation Bar
View Original Published Thread

Data filter for drop down box

OrthogonalCrow3
Level II

Hi, all. There might be similar questions here,  but I didn't find one that solves my problem.

On the dashboard, I made inputs into a drop down box. i want the output table to change when I select different inputs. 

What functions should I use and is there a sample somewhere?

Thank you so much!

1 REPLY 1


Re: Data filter for drop down box

You can use the << Set function. Please refer to the following page.

https://community.jmp.com/t5/JMP-Knowledge-Base/How-to-dynamically-populate-a-ComboBox-based-upon-us... 

Here is an example.

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

make_tabulate_script = Function( {col},
	tablate_script = Parse(
		Eval Insert(
			"dt << Tabulate(
		Show Control Panel( 0 ),
		Add Table(
			Column Table( Analysis Columns( ^col^ ), Statistics( Mean ) ),
			Row Table( Grouping Columns( :sex ) )
		)
	)"
		)
	);
	Eval Expr( tablate_script );
);

tablate_script = make_tabulate_script( ":height" );

nw = New Window( "new window",
	vb1 = H List Box(
		V List Box(
			Text Box( "Please Slect" ),
			cb = Combo Box(
				{":height", ":weight"},
				<<set function(
					Function( {this, index},
						Try( table << delete );
						Match( index,
							1,
								tablate_script = make_tabulate_script( ":height" );
								vb1 << append( table = Eval( tablate_script ) );,
							2,
								tablate_script = make_tabulate_script( ":weight" );
								vb1 << append( table = Eval( tablate_script ) );
						);
					)
				)
			)
		),
		table = Eval( tablate_script )
	)
);