<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Update a List Box Based on a Combo Box Selection in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Update-a-List-Box-Based-on-a-Combo-Box-Selection/m-p/54473#M30794</link>
    <description>&lt;P&gt;The main issue is that what is returned from the&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;cb &amp;lt;&amp;lt; Get Selected&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is not a variable name, as you were wanting it to be, but rather a string, "Fruit" or "Vegetables".&amp;nbsp; That is, the names of the 2 list are Fruit and Vegetables, not "Fruit" and "Vegetables".&lt;/P&gt;
&lt;P&gt;Below is a script that works the way you want.&amp;nbsp; There are other ways to do this, that others may want to contribute&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
TestArray = {"Fruit", "Vegetables"}; //my list of 'stuff'
Fruit = {"Oranges", "Apples", "Grapes"};
Vegetables = {"Corn", "Squash", "Eggplants"};


nw = New Window( "Sample",
	&amp;lt;&amp;lt;modal,
	vlb = H List Box(
		cb = Combo Box(
			TestArray,
			tb2 &amp;lt;&amp;lt; remove all;
			If( (cb &amp;lt;&amp;lt; Get Selected) == "Fruit",
				tb2 &amp;lt;&amp;lt; Append( Fruit ),
				tb2 &amp;lt;&amp;lt; Append( Vegetables )
			);
		),
		tb2 = List Box()
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Apr 2018 23:34:35 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2018-04-04T23:34:35Z</dc:date>
    <item>
      <title>Update a List Box Based on a Combo Box Selection</title>
      <link>https://community.jmp.com/t5/Discussions/Update-a-List-Box-Based-on-a-Combo-Box-Selection/m-p/54470#M30791</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I have a few lists, in this case fruit and vegetables, and based on my selection on the combo box I would like to populate the list box with the new list. For example, if I have "fruit" selected, I want the list box to display oranges, apples, and grapes. The script I have works, but it doesnt evaluate the list AND I also do not want it to keep appending the list box with my selection. Is there a way around this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;TestArray = {"Fruit", "Vegetables"}; //my list of 'stuff'
Fruit = {"Oranges", "Apples", "Grapes"};
Vegetables = {"Corn", "Squash", "Eggplants"};


nw = New Window( "Sample",
	&amp;lt;&amp;lt;Modal,
	vlb = H List Box(
		cb = Combo Box(
			TestArray,
			tb2 &amp;lt;&amp;lt; Append(cb &amp;lt;&amp;lt; Get Selected);
		),
		tb2 = List Box()
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 23:02:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-a-List-Box-Based-on-a-Combo-Box-Selection/m-p/54470#M30791</guid>
      <dc:creator>Ksrzg01</dc:creator>
      <dc:date>2018-04-04T23:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: Update a List Box Based on a Combo Box Selection</title>
      <link>https://community.jmp.com/t5/Discussions/Update-a-List-Box-Based-on-a-Combo-Box-Selection/m-p/54471#M30792</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/8754"&gt;@Ksrzg01&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Try this. The list needs to be evaluated before its elements can be populated into the list box and a way to acheive it is as shown below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;TestArray = {"Fruit", "Vegetables"}; //my list of 'stuff'
Fruit = {"Oranges", "Apples", "Grapes"};
Vegetables = {"Corn", "Squash", "Eggplants"};
MyLists = {Fruit,Vegetables}; 

nw = New Window( "Sample",
	&amp;lt;&amp;lt;Modal,
	vlb = H List Box(
		cb = Combo Box(TestArray,
						MySelection = cb &amp;lt;&amp;lt; Get Selected; 
						tb2 &amp;lt;&amp;lt; Append(Eval(Parse(Eval Insert("\[^MySelection^]\"))));
					  ),
		tb2 = List Box()
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 23:33:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-a-List-Box-Based-on-a-Combo-Box-Selection/m-p/54471#M30792</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2018-04-04T23:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: Update a List Box Based on a Combo Box Selection</title>
      <link>https://community.jmp.com/t5/Discussions/Update-a-List-Box-Based-on-a-Combo-Box-Selection/m-p/54473#M30794</link>
      <description>&lt;P&gt;The main issue is that what is returned from the&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;cb &amp;lt;&amp;lt; Get Selected&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is not a variable name, as you were wanting it to be, but rather a string, "Fruit" or "Vegetables".&amp;nbsp; That is, the names of the 2 list are Fruit and Vegetables, not "Fruit" and "Vegetables".&lt;/P&gt;
&lt;P&gt;Below is a script that works the way you want.&amp;nbsp; There are other ways to do this, that others may want to contribute&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
TestArray = {"Fruit", "Vegetables"}; //my list of 'stuff'
Fruit = {"Oranges", "Apples", "Grapes"};
Vegetables = {"Corn", "Squash", "Eggplants"};


nw = New Window( "Sample",
	&amp;lt;&amp;lt;modal,
	vlb = H List Box(
		cb = Combo Box(
			TestArray,
			tb2 &amp;lt;&amp;lt; remove all;
			If( (cb &amp;lt;&amp;lt; Get Selected) == "Fruit",
				tb2 &amp;lt;&amp;lt; Append( Fruit ),
				tb2 &amp;lt;&amp;lt; Append( Vegetables )
			);
		),
		tb2 = List Box()
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 23:34:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-a-List-Box-Based-on-a-Combo-Box-Selection/m-p/54473#M30794</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-04-04T23:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: Update a List Box Based on a Combo Box Selection</title>
      <link>https://community.jmp.com/t5/Discussions/Update-a-List-Box-Based-on-a-Combo-Box-Selection/m-p/54497#M30810</link>
      <description>&lt;P&gt;Thanks Nelson! One last question, when I do tb2 &amp;lt;&amp;lt; Get Selection, I get an output in {"Apples"} format, any way to convert to just "Apples"? Substr and Word function are not working.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 16:55:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-a-List-Box-Based-on-a-Combo-Box-Selection/m-p/54497#M30810</guid>
      <dc:creator>Ksrzg01</dc:creator>
      <dc:date>2018-04-05T16:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: Update a List Box Based on a Combo Box Selection</title>
      <link>https://community.jmp.com/t5/Discussions/Update-a-List-Box-Based-on-a-Combo-Box-Selection/m-p/54498#M30811</link>
      <description>&lt;P&gt;1. What has been returned is a List.&amp;nbsp; To get the specific value from a list, all you have to do is to ask for the specific element from the list.&amp;nbsp; In your case, there is only one element being returned, so you just have to specify&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;(tb2 &amp;lt;&amp;lt; Get Selection)[1]&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;2.&amp;nbsp;Your venture into JSL will remain a mistery until you spend the time reading the Scripting Guide.&amp;nbsp; It describes not just the syntax, but even more impotantly, the language structures( Lists, Matrices, etc. ).&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Help==&amp;gt;Books==&amp;gt;Scripting Guide&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 17:03:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-a-List-Box-Based-on-a-Combo-Box-Selection/m-p/54498#M30811</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-04-05T17:03:32Z</dc:date>
    </item>
  </channel>
</rss>

