<?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 Dynamic  display box based on combo box selection in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Dynamic-display-box-based-on-combo-box-selection/m-p/373519#M62317</link>
    <description>&lt;P&gt;Looking for some help here, I can't get the display box to work correctly as it kept changing back to a blank window when "Option 1" is re-selected (some photos for reference).&amp;nbsp;&lt;/P&gt;&lt;P&gt;Really appreciate the help!&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);

Buttons = {"Button 1", "Button 2", "Button3"};
Boxes = {"Box 1", "Box 2", "Box 3"};

LB_Input_1 = lineupbox(ncol(2),spacing(5));
for(i=1,i&amp;lt;=nitems(Buttons),i++,
	label1 = char(Buttons[i]);
	bblabel1 = "clb_" || char(i);
	eval(parse(evalinsert("\[LB_Input_1 &amp;lt;&amp;lt; append(buttonbox("^label1^", ^bblabel1^ &amp;lt;&amp;lt; append(clb2 &amp;lt;&amp;lt; get selected)))]\")));
	eval(parse(evalinsert("\[LB_Input_1 &amp;lt;&amp;lt; append(^bblabel1^ = col list box("Numeric",minitems(1),maxitems(1),nlines(1)))]\")));
);
for(i=1,i&amp;lt;=nitems(Boxes),i++,
	label1 = char(Boxes[i]);
	neblabel1 = "neb_"||char(i);
	eval(parse(evalinsert("\[LB_input_1 &amp;lt;&amp;lt; append(Text box("^label1^"))]\")));
	eval(parse(evalinsert("\[LB_input_1 &amp;lt;&amp;lt; append(^neblabel1^ = Number edit box())]\")));
);
HB1 = hlistbox(
		clb2 = filter col selector(dt1,all),
		LB_input_1
	);

LB_Input_2 = lineupbox(ncol(2),spacing(5));
for(i=1,i&amp;lt;=nitems(Buttons)-1,i++,
	label1 = char(Buttons[i]);
	bblabel1 = "clb_" || char(i);
	eval(parse(evalinsert("\[LB_Input_2 &amp;lt;&amp;lt; append(buttonbox("^label1^", ^bblabel1^ &amp;lt;&amp;lt; append(clb2 &amp;lt;&amp;lt; get selected)))]\")));
	eval(parse(evalinsert("\[LB_Input_2 &amp;lt;&amp;lt; append(^bblabel1^ = col list box("Numeric",minitems(1),maxitems(1),nlines(1)))]\")));
);
for(i=1,i&amp;lt;=nitems(Boxes)-1,i++,
	label1 = char(Boxes[i]);
	neblabel1 = "neb_"||char(i);
	eval(parse(evalinsert("\[LB_input_2 &amp;lt;&amp;lt; append(Text box("^label1^"))]\")));
	eval(parse(evalinsert("\[LB_input_2 &amp;lt;&amp;lt; append(^neblabel1^ = Number edit box())]\")));
);
HB2 = hlistbox(
		clb2 = filter col selector(dt1,all),
		LB_input_2
	);

dt1 = current data table();
new window("Test",
	vb1 = vlistbox(Text box(""),
		Panel Box("Selection Option",H list box(text box("Select: "),
			combo1 = combobox({"Option 1","Option 2"},
				&amp;lt;&amp;lt; set function(function({this,index},
					match(index,
						1,
						vb1 &amp;lt;&amp;lt; append (try(view &amp;lt;&amp;lt; delete);
							view = HB1;
						),
						2,
						vb1 &amp;lt;&amp;lt; append (try(view &amp;lt;&amp;lt; delete);
							view = HB2;
						)
					)
				))
			)
		)
	),
	text box (""),
	view = HB1;
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Djtjhin_3-1617284621732.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/31824i31D50463E47E7A36/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Djtjhin_3-1617284621732.png" alt="Djtjhin_3-1617284621732.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Djtjhin_4-1617284649671.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/31825i779F33DE426214AA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Djtjhin_4-1617284649671.png" alt="Djtjhin_4-1617284649671.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Djtjhin_5-1617284669924.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/31826iE6FCDCE469EAD9F7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Djtjhin_5-1617284669924.png" alt="Djtjhin_5-1617284669924.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 11 Jun 2023 11:12:36 GMT</pubDate>
    <dc:creator>Djtjhin</dc:creator>
    <dc:date>2023-06-11T11:12:36Z</dc:date>
    <item>
      <title>Dynamic  display box based on combo box selection</title>
      <link>https://community.jmp.com/t5/Discussions/Dynamic-display-box-based-on-combo-box-selection/m-p/373519#M62317</link>
      <description>&lt;P&gt;Looking for some help here, I can't get the display box to work correctly as it kept changing back to a blank window when "Option 1" is re-selected (some photos for reference).&amp;nbsp;&lt;/P&gt;&lt;P&gt;Really appreciate the help!&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);

Buttons = {"Button 1", "Button 2", "Button3"};
Boxes = {"Box 1", "Box 2", "Box 3"};

LB_Input_1 = lineupbox(ncol(2),spacing(5));
for(i=1,i&amp;lt;=nitems(Buttons),i++,
	label1 = char(Buttons[i]);
	bblabel1 = "clb_" || char(i);
	eval(parse(evalinsert("\[LB_Input_1 &amp;lt;&amp;lt; append(buttonbox("^label1^", ^bblabel1^ &amp;lt;&amp;lt; append(clb2 &amp;lt;&amp;lt; get selected)))]\")));
	eval(parse(evalinsert("\[LB_Input_1 &amp;lt;&amp;lt; append(^bblabel1^ = col list box("Numeric",minitems(1),maxitems(1),nlines(1)))]\")));
);
for(i=1,i&amp;lt;=nitems(Boxes),i++,
	label1 = char(Boxes[i]);
	neblabel1 = "neb_"||char(i);
	eval(parse(evalinsert("\[LB_input_1 &amp;lt;&amp;lt; append(Text box("^label1^"))]\")));
	eval(parse(evalinsert("\[LB_input_1 &amp;lt;&amp;lt; append(^neblabel1^ = Number edit box())]\")));
);
HB1 = hlistbox(
		clb2 = filter col selector(dt1,all),
		LB_input_1
	);

LB_Input_2 = lineupbox(ncol(2),spacing(5));
for(i=1,i&amp;lt;=nitems(Buttons)-1,i++,
	label1 = char(Buttons[i]);
	bblabel1 = "clb_" || char(i);
	eval(parse(evalinsert("\[LB_Input_2 &amp;lt;&amp;lt; append(buttonbox("^label1^", ^bblabel1^ &amp;lt;&amp;lt; append(clb2 &amp;lt;&amp;lt; get selected)))]\")));
	eval(parse(evalinsert("\[LB_Input_2 &amp;lt;&amp;lt; append(^bblabel1^ = col list box("Numeric",minitems(1),maxitems(1),nlines(1)))]\")));
);
for(i=1,i&amp;lt;=nitems(Boxes)-1,i++,
	label1 = char(Boxes[i]);
	neblabel1 = "neb_"||char(i);
	eval(parse(evalinsert("\[LB_input_2 &amp;lt;&amp;lt; append(Text box("^label1^"))]\")));
	eval(parse(evalinsert("\[LB_input_2 &amp;lt;&amp;lt; append(^neblabel1^ = Number edit box())]\")));
);
HB2 = hlistbox(
		clb2 = filter col selector(dt1,all),
		LB_input_2
	);

dt1 = current data table();
new window("Test",
	vb1 = vlistbox(Text box(""),
		Panel Box("Selection Option",H list box(text box("Select: "),
			combo1 = combobox({"Option 1","Option 2"},
				&amp;lt;&amp;lt; set function(function({this,index},
					match(index,
						1,
						vb1 &amp;lt;&amp;lt; append (try(view &amp;lt;&amp;lt; delete);
							view = HB1;
						),
						2,
						vb1 &amp;lt;&amp;lt; append (try(view &amp;lt;&amp;lt; delete);
							view = HB2;
						)
					)
				))
			)
		)
	),
	text box (""),
	view = HB1;
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Djtjhin_3-1617284621732.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/31824i31D50463E47E7A36/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Djtjhin_3-1617284621732.png" alt="Djtjhin_3-1617284621732.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Djtjhin_4-1617284649671.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/31825i779F33DE426214AA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Djtjhin_4-1617284649671.png" alt="Djtjhin_4-1617284649671.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Djtjhin_5-1617284669924.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/31826iE6FCDCE469EAD9F7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Djtjhin_5-1617284669924.png" alt="Djtjhin_5-1617284669924.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 11:12:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Dynamic-display-box-based-on-combo-box-selection/m-p/373519#M62317</guid>
      <dc:creator>Djtjhin</dc:creator>
      <dc:date>2023-06-11T11:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic  display box based on combo box selection</title>
      <link>https://community.jmp.com/t5/Discussions/Dynamic-display-box-based-on-combo-box-selection/m-p/373571#M62323</link>
      <description>&lt;P&gt;Issue and how to debug:&lt;/P&gt;&lt;P&gt;1. Run the script&lt;/P&gt;&lt;P&gt;2. Check the content of HB1 and HB2 (DisplayBox[ListBox])&lt;/P&gt;&lt;P&gt;3. Change to Option 2 and check content of HB1 (DisplayBox[])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quick (and dirty fix?) that could possibly help. See how I changed HB1 and HB2 reference locations and made them Expressions:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);

Buttons = {"Button 1", "Button 2", "Button3"};
Boxes = {"Box 1", "Box 2", "Box 3"};

HB1 = Expr(
LB_Input_1 = lineupbox(ncol(2),spacing(5));
for(i=1,i&amp;lt;=nitems(Buttons),i++,
	label1 = char(Buttons[i]);
	bblabel1 = "clb_" || char(i);
	eval(parse(evalinsert("\[LB_Input_1 &amp;lt;&amp;lt; append(buttonbox("^label1^", ^bblabel1^ &amp;lt;&amp;lt; append(clb2 &amp;lt;&amp;lt; get selected)))]\")));
	eval(parse(evalinsert("\[LB_Input_1 &amp;lt;&amp;lt; append(^bblabel1^ = col list box("Numeric",minitems(1),maxitems(1),nlines(1)))]\")));
);
for(i=1,i&amp;lt;=nitems(Boxes),i++,
	label1 = char(Boxes[i]);
	neblabel1 = "neb_"||char(i);
	eval(parse(evalinsert("\[LB_input_1 &amp;lt;&amp;lt; append(Text box("^label1^"))]\")));
	eval(parse(evalinsert("\[LB_input_1 &amp;lt;&amp;lt; append(^neblabel1^ = Number edit box())]\")));
);
hlistbox(
		clb2 = filter col selector(dt1,all),
		LB_input_1
	);
);

HB2 = Expr(
LB_Input_2 = lineupbox(ncol(2),spacing(5));
for(i=1,i&amp;lt;=nitems(Buttons)-1,i++,
	label1 = char(Buttons[i]);
	bblabel1 = "clb_" || char(i);
	eval(parse(evalinsert("\[LB_Input_2 &amp;lt;&amp;lt; append(buttonbox("^label1^", ^bblabel1^ &amp;lt;&amp;lt; append(clb2 &amp;lt;&amp;lt; get selected)))]\")));
	eval(parse(evalinsert("\[LB_Input_2 &amp;lt;&amp;lt; append(^bblabel1^ = col list box("Numeric",minitems(1),maxitems(1),nlines(1)))]\")));
);
for(i=1,i&amp;lt;=nitems(Boxes)-1,i++,
	label1 = char(Boxes[i]);
	neblabel1 = "neb_"||char(i);
	eval(parse(evalinsert("\[LB_input_2 &amp;lt;&amp;lt; append(Text box("^label1^"))]\")));
	eval(parse(evalinsert("\[LB_input_2 &amp;lt;&amp;lt; append(^neblabel1^ = Number edit box())]\")));
);
hlistbox(
		clb2 = filter col selector(dt1,all),
		LB_input_2
	);
);
dt1 = current data table();
new window("Test",
	vb1 = vlistbox(Text box(""),
		Panel Box("Selection Option",H list box(text box("Select: "),
			combo1 = combobox({"Option 1","Option 2"},
				&amp;lt;&amp;lt; set function(function({this,index},
					try(view &amp;lt;&amp;lt; delete);
					match(index,
						1,
						vb1 &amp;lt;&amp;lt; append (
							view = HB1;
						),
						2,
						vb1 &amp;lt;&amp;lt; append (
							view = HB2;
						)
					)
				))
			)
		)
	),
	text box (""),
	view = HB1;
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Apr 2021 15:34:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Dynamic-display-box-based-on-combo-box-selection/m-p/373571#M62323</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-04-01T15:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic  display box based on combo box selection</title>
      <link>https://community.jmp.com/t5/Discussions/Dynamic-display-box-based-on-combo-box-selection/m-p/374299#M62412</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt; :)&lt;/img&gt; The solution works!&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a follow up though, could you clarify the 3-debugging-steps you mentioned ? I don't quite get that comment.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Issue and how to debug:&lt;/P&gt;&lt;P&gt;1. Run the script&lt;/P&gt;&lt;P&gt;2. Check the content of HB1 and HB2 (DisplayBox[ListBox])&lt;/P&gt;&lt;P&gt;3. Change to Option 2 and check content of HB1 (DisplayBox[])&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 05 Apr 2021 04:40:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Dynamic-display-box-based-on-combo-box-selection/m-p/374299#M62412</guid>
      <dc:creator>Djtjhin</dc:creator>
      <dc:date>2021-04-05T04:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic  display box based on combo box selection</title>
      <link>https://community.jmp.com/t5/Discussions/Dynamic-display-box-based-on-combo-box-selection/m-p/374535#M62431</link>
      <description>&lt;P&gt;Sure.&amp;nbsp;Hopefully this helps:&lt;/P&gt;&lt;P&gt;1. Open log window&lt;/P&gt;&lt;P&gt;2. Run the script -&amp;gt; Runs fine&lt;/P&gt;&lt;P&gt;3. Change option from Option 1 to Option 2 -&amp;gt; Works fine&lt;/P&gt;&lt;P&gt;4. Change option from Option 2 to Option 1 -&amp;gt; Display Box disappears&lt;/P&gt;&lt;P&gt;5. Change option from Option 1 back to Option 2 -&amp;gt; Display Box still missing&lt;/P&gt;&lt;P&gt;At this point I started wondering if something is wrong with HB1 and HB2, and if they get deleted when you change options.&amp;nbsp;&lt;/P&gt;&lt;P&gt;6. Run script again. Highlight HB1 from the Script Window and run the script to get info on variable to Log Window (DisplayBox[ListBox])&lt;/P&gt;&lt;P&gt;7. Change option from Option 1 to Option 2.&amp;nbsp;Highlight HB1 from the Script Window and run the script to get info on variable to Log Window (DisplayBox[])&lt;/P&gt;&lt;P&gt;8. Notice that ListBox has disappeared&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1617688551034.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/31897i1341F7608F014AA6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1617688551034.png" alt="jthi_0-1617688551034.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;9. Start figuring out what goes wrong and how to fix it&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This might help you figure out what is going on: at some point HB1 and HB2 H List Boxes get deleted.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Apr 2021 06:01:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Dynamic-display-box-based-on-combo-box-selection/m-p/374535#M62431</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-04-06T06:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic  display box based on combo box selection</title>
      <link>https://community.jmp.com/t5/Discussions/Dynamic-display-box-based-on-combo-box-selection/m-p/374645#M62442</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;Thanks for explaining your debugging approach!&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do see the "Displaybox[]" quite often in the log but I guess I didn't really get what the log means. Thanks for the pointers!&lt;/P&gt;</description>
      <pubDate>Tue, 06 Apr 2021 15:53:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Dynamic-display-box-based-on-combo-box-selection/m-p/374645#M62442</guid>
      <dc:creator>Djtjhin</dc:creator>
      <dc:date>2021-04-06T15:53:58Z</dc:date>
    </item>
  </channel>
</rss>

