<?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 Error when using Try() on Collistbox() in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Error-when-using-Try-on-Collistbox/m-p/533192#M75604</link>
    <description>&lt;P&gt;Basically I'm building a custom interactive window which includes different display boxes and I'm trying to simplify the selection input with a for loop. For instance, I have both a combobox &amp;amp; a collistbox and I'm trying to get input for both using a loop statement. But when I did this, I got an error instead. Am I writing the expression incorrectly ? (error log attached)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
New Window( "Col List Box Example",
	vlistbox(
		var1 = combobox({"one", "two", "three"}),
		hlistbox(Col List Box( all, width( 250 ), maxSelected( 1 ) ),
			var2 = Col List Box()	
		)	
	)
);

var2 &amp;lt;&amp;lt; append("height");

AA = {"",""};

for(i=1,i&amp;lt;=2,i++,
	temp1 = "var"||char(i);
	eval(
		substitute(
			expr(try(AA[i] = expr.temp1 &amp;lt;&amp;lt; get, AA[i] = expr.temp1 &amp;lt;&amp;lt; get items)), //try to use get, if error, use get items
			expr(expr.temp1),parse(temp1)
		)
	)
);

show(AA);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 17:07:32 GMT</pubDate>
    <dc:creator>Djtjhin</dc:creator>
    <dc:date>2023-06-09T17:07:32Z</dc:date>
    <item>
      <title>Error when using Try() on Collistbox()</title>
      <link>https://community.jmp.com/t5/Discussions/Error-when-using-Try-on-Collistbox/m-p/533192#M75604</link>
      <description>&lt;P&gt;Basically I'm building a custom interactive window which includes different display boxes and I'm trying to simplify the selection input with a for loop. For instance, I have both a combobox &amp;amp; a collistbox and I'm trying to get input for both using a loop statement. But when I did this, I got an error instead. Am I writing the expression incorrectly ? (error log attached)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
New Window( "Col List Box Example",
	vlistbox(
		var1 = combobox({"one", "two", "three"}),
		hlistbox(Col List Box( all, width( 250 ), maxSelected( 1 ) ),
			var2 = Col List Box()	
		)	
	)
);

var2 &amp;lt;&amp;lt; append("height");

AA = {"",""};

for(i=1,i&amp;lt;=2,i++,
	temp1 = "var"||char(i);
	eval(
		substitute(
			expr(try(AA[i] = expr.temp1 &amp;lt;&amp;lt; get, AA[i] = expr.temp1 &amp;lt;&amp;lt; get items)), //try to use get, if error, use get items
			expr(expr.temp1),parse(temp1)
		)
	)
);

show(AA);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 17:07:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Error-when-using-Try-on-Collistbox/m-p/533192#M75604</guid>
      <dc:creator>Djtjhin</dc:creator>
      <dc:date>2023-06-09T17:07:32Z</dc:date>
    </item>
    <item>
      <title>Re: Error when using Try() on Collistbox()</title>
      <link>https://community.jmp.com/t5/Discussions/Error-when-using-Try-on-Collistbox/m-p/533211#M75607</link>
      <description>&lt;P&gt;I think your Try doesn't work because &amp;lt;&amp;lt; Get doesn't rise an error when used with ListBoxBox (just a message to log). If you want to get values this way, you could for example use &amp;lt;&amp;lt; Class Name:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");
New Window("Col List Box Example",
	V List Box(
		var1 = Combo Box({"one", "two", "three"}),
		H List Box(Col List Box(all, width(250), maxSelected(1)), var2 = Col List Box())
	)
);

var2 &amp;lt;&amp;lt; append("height");

AA = {"", ""};
For(i = 1, i &amp;lt;= 2, i++,
	temp1 = "var" || Char(i);
	Eval(
		Substitute(
				Expr(
					If(expr.temp1 &amp;lt;&amp;lt; class name == "ComboBox",
						AA[i] = expr.temp1 &amp;lt;&amp;lt; get
					,
						AA[i] = expr.temp1 &amp;lt;&amp;lt; get items					
					)
				), //try to use get, if error, use get items
			Expr(expr.temp1), Parse(temp1)
		)
	);
);

Show(AA); //AA = {1, {"height"}};
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would usually suggest not getting the values like this and try to figure some other way than dynamically creating variable names (storing references to list or associative array for example).&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 07:35:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Error-when-using-Try-on-Collistbox/m-p/533211#M75607</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-08-12T07:35:13Z</dc:date>
    </item>
  </channel>
</rss>

