Subscribe Bookmark RSS Feed

Produce listbox conditionally based off combobox selection

Highlighted
kage

New Contributor

Joined:

Jul 13, 2017

Hello JMP Community,

 

I have browsed the discussion boards and this one has me stumped. I am a fairly new JSL user and am having issues passing a list to a listbox dynamically based off of a combobox selection. Utimately, I am trying to create listboxes based off of a combobox selection, but to start I am trying to simply pass a specific list dependent on a combobox selection. I have seen some examples using the combobox to update a listbox based off of table results, I am trying to simplify things further by defining explicit lists and am having issues with the listbox not reflecting new assignments to the list argument. Here is my code with some commented out sections showing my original intent and moving backwards trying to debug.

 

Names Default To Here( 1 );
Clear Symbols();
New Window( "Example",

	H List Box(
		cb1 = Combo Box(
			{"<Select Type>", "First N Cycles", "Last N Cycles", "Cycle Interval", "Select Cycles"},
			<<SetFunction(
				Function( {this},
					selection = this << Get();
					cyclesavailable = {1,2,3,4,5,6,7};
					
					/*
					If(
						Num(selection) == 1,
						Dialog( "Reset", Button( "OK" ) ),
						Num(selection) == 2,
						cyclesavailable = {1,2,3,4,5,6,7},
						selection > 2,
						Dialog("this is lame", Button("OK")) 						
					);
					*/
					
					/*
					Choose(selection,
						//Select from drop down
						Dialog( "Reset", Button( "OK" ) ), 
						//First N Cycles picked
						cyclesavailable << Set Items({1,2,3,4,5,6,7}), 
						//Last N Cycles picked
						cyclesavailable << Set Items({8,9,10,11,12,13}), 
						//Cycle Interval picked
						Dialog( "Cycle Interval", Button( "OK" ) ), 
						//Select Cycles piked
						Dialog( "Select Cycles", Button( "OK" ) ), 
						//Error Catching
						Dialog( "Something went wrong with combobox cycletype", Button( "OK" ) )
						
					);
					*/
					
					cb2 << Set Items (cyclesavailable);
					
				)
				
			)
		),
		cb2 = List Box(
			{"<Select Filter Type>"}
		)
		
	)
)

 

It seems cb2 will not update the listbox with the list that is assigned within the cb1 combobox script. Any help is greatly appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
David_Burnham

Super User

Joined:

Jul 13, 2011

Solution

The list you are assigning needs to contain string items:

 

cyclesavailable = {"1","2","3","4","5","6","7"};

-Dave
2 REPLIES
David_Burnham

Super User

Joined:

Jul 13, 2011

Solution

The list you are assigning needs to contain string items:

 

cyclesavailable = {"1","2","3","4","5","6","7"};

-Dave
kage

New Contributor

Joined:

Jul 13, 2017

/* Slaps head */

 

Of course it does! Thanks for the quick reply Dave, I need to remember the basics...

BTW I really enjoyed your articles at pega analytics, they helped me get up and running (until this one).