cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.
  • JMP will suspend normal business operations for our Rest and Recharge Day on Friday, October 2, 2026.
    Regular business hours will resume on Monday, October 5, 2026.

JMP Knowledge Base

Choose Language Hide Translation Bar
How to dynamically populate a ComboBox based upon user selection

Overview

This example demonstrates how you can dynamically populate a ComboBox with options that are relevant to a user selection made in a previous ListBox.

 

Instructions

In a JMP® session, click the File menu and select New ► Script. Copy the below script and paste it into the script window. To run the sample script, click the Edit menu and select Run Script.

/* Open a sample data table */ 
dt = Open( "$SAMPLE_DATA\Big Class.jmp", "Invisible" );

/* Extract a list of unique ages */
Summarize( a = By( :age ) );

/* Create a modal dialog */ 
New Window( "Example",
	<<Modal,
	H List Box(/* Upon selecting an age, populate the ComboBox with corresponding names */
		Panel Box( "Select an Age:",
			cb1 = List Box(
				a,
				Max Selected( 1 ),
				<<SetFunction(
					Function( {this},
						selection = (this << Get Selected)[1];
						r = dt << Get Rows Where( :age == Num( selection ) );
						ageNames = :name[r];
						Insert Into( ageNames, "<Select Name>", 1 );
						cb2 << Set Items( ageNames );
					)
				)
			)
		), /* Print the selected values from the ListBox and ComboBox in the log */
		Panel Box( "Select a Name:",
			cb2 = Combo Box(
				{"<Select Name>"},
				<<SetFunction( Function( {this}, Print( selection, this << Get Selected() ) ) )
			)
		)
	)
);

 

Additional Documentation

More information about the JMP Scripting Language can be found in the JMP Scripting Guide. You can access the guide from within JMP by clicking on the Help menu and select JMP Help.  From the online Table of Contents, choose Scripting Guide.

 

[Previously JMP Note 54614]

Details
Operating System
macOS Windows
Products JMP JMP Pro

Recommended Articles