cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

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

Get default value of combo box without change

Hi,

 

Is there a way to get a default value without any click?

I want to save the default value in a variable which in this case should be "one". Any Suggestion?

 

Here is what I tried

Names Default To Here( 1 );
New Window( "Example",
	cb = Combo Box(
		{"One", "Two", "Three"},
		<<set function(function({self},
		cb << set(1, runscript(1));
		selection = cb << GetSelected();
		Print( "Selected: " || selection )));
	)
);
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Get default value of combo box without change

I usually use initialization values at the start of script (or configuration file). Below is simple example how those could be used here 

Names Default To Here(1);
cb_vals = {"One", "Two", "Three"};
init_cb_val = "Two";

New Window("Example",
	cb = Combo Box(
		cb_vals,
		<<set function(
			Function({self},
				selection = cb << GetSelected();
				Print("Selected: " || selection);
			)
		),
		<< Set(Contains(cb_vals, init_cb_val), 1)
	)
);

You can then initialize the selectors final value with same init_cb_val if you want to

-Jarmo

View solution in original post

2 REPLIES 2
mmarchandTSI
Level V

Re: Get default value of combo box without change

I would probably do something like this.

 

default = (cb << Get Items)[1];
jthi
Super User

Re: Get default value of combo box without change

I usually use initialization values at the start of script (or configuration file). Below is simple example how those could be used here 

Names Default To Here(1);
cb_vals = {"One", "Two", "Three"};
init_cb_val = "Two";

New Window("Example",
	cb = Combo Box(
		cb_vals,
		<<set function(
			Function({self},
				selection = cb << GetSelected();
				Print("Selected: " || selection);
			)
		),
		<< Set(Contains(cb_vals, init_cb_val), 1)
	)
);

You can then initialize the selectors final value with same init_cb_val if you want to

-Jarmo

Recommended Articles