<?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 using loop to display a tab box inside a tab box in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/using-loop-to-display-a-tab-box-inside-a-tab-box/m-p/193039#M41290</link>
    <description>&lt;P&gt;Hi guys , I am trying to display a tab box inside a tab box using loop&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is my code , however it does not allowa me to use array , only variablee allowed .&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Window( "Result", display = Tab Box() );
For( j = 1, j &amp;lt;= N Items( stepname ), j++,
	step = Substitute( Char( stepname[j] ), "DataTable(\!"Specname=", "" );
	display &amp;lt;&amp;lt; Add(
		step,
		main[j] = Tab Box(
			
		)
	);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 15 Apr 2019 15:22:58 GMT</pubDate>
    <dc:creator>kuannygoh</dc:creator>
    <dc:date>2019-04-15T15:22:58Z</dc:date>
    <item>
      <title>using loop to display a tab box inside a tab box</title>
      <link>https://community.jmp.com/t5/Discussions/using-loop-to-display-a-tab-box-inside-a-tab-box/m-p/193039#M41290</link>
      <description>&lt;P&gt;Hi guys , I am trying to display a tab box inside a tab box using loop&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is my code , however it does not allowa me to use array , only variablee allowed .&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;New Window( "Result", display = Tab Box() );
For( j = 1, j &amp;lt;= N Items( stepname ), j++,
	step = Substitute( Char( stepname[j] ), "DataTable(\!"Specname=", "" );
	display &amp;lt;&amp;lt; Add(
		step,
		main[j] = Tab Box(
			
		)
	);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Apr 2019 15:22:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/using-loop-to-display-a-tab-box-inside-a-tab-box/m-p/193039#M41290</guid>
      <dc:creator>kuannygoh</dc:creator>
      <dc:date>2019-04-15T15:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: using loop to display a tab box inside a tab box</title>
      <link>https://community.jmp.com/t5/Discussions/using-loop-to-display-a-tab-box-inside-a-tab-box/m-p/193123#M41314</link>
      <description>&lt;P&gt;From your brief description, it seems you are trying to display different specs for different steps. The first script shows a method that uses arrays to make a tabbed display of tabs.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here(1);
steps= {"A", "B", "C", "D"};
step_aa = Associative Array(steps);
step_aa["A"] = {"1101", "1102", "1103", "1104"};
step_aa["B"] = {"2101", "2102", "2207", "2068", "270X"};
step_aa["C"] = {"37Z0", "3027", "3133"};
step_aa["D"] = {"4001", "4005", "4517"};

main={};
New Window( "Result", display = Tab Box() );
For( j = 1, j &amp;lt;= N Items( stepname ), j++,
	display &amp;lt;&amp;lt; Add(
		steps[j], PanelBox("",
		tb = Tab Box();
	));
	tb &amp;lt;&amp;lt; Set OverFlow Enabled(0);
	insert into(main,tb);
);
For( j = 1, j &amp;lt;= N Items( stepname ), j++,
		for(k=1, k&amp;lt;=nitems(step_aa[steps[j]]), k++,	
		  main[j] &amp;lt;&amp;lt; Add (EvalInsert("Data Table(\!"Specname=^step_aa[steps[j]][k]^\!")"))
		  
		); // add for k   
		main[j] &amp;lt;&amp;lt; set selected(1); //select the first tab
);
display &amp;lt;&amp;lt; set selected(1);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/16893iBA1A339D6C3C3C6C/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.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;However, I think a better option is to use a Tree with TreeNodes. Below is an example and the resulting display.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here(1);
steps= {"A", "B", "C", "D"};
step_aa = Associative Array(steps);
step_aa["A"] = {"1101", "1102", "1103", "1104"};
step_aa["B"] = {"2101", "2102", "2207", "2068", "270X"};
step_aa["C"] = {"37Z0", "3027", "3133"};
step_aa["D"] = {"4001", "4005", "4517"};


roots = {};
For( j = 1, j &amp;lt;= N Items( steps ), j++,
   root = TreeNode(stepname[j]);
   insert into(roots, root);
);
For( j = 1, j &amp;lt;= N Items( steps ), j++,
   For(k =1, k&amp;lt;=nitems(step_aa[steps[j]]), k++,
      c = Tree Node( step_aa[steps[j]][k] );
      roots[j] &amp;lt;&amp;lt; Append(c);
   );
);
New Window( "TreeBox Tests",
	HListBox(
	   tree = Tree Box( roots, Size( 300, 200 ) ),
	   tb = TextBox()
	)
);
tree &amp;lt;&amp;lt; Set Node Select Script(
	Function( {thistree, thisnode},
		If( !Is Empty( thisnode ),
		    txt = thisnode &amp;lt;&amp;lt; get label;
			tb &amp;lt;&amp;lt; set text ( EvalInsert("Data Table(\!"Specname=^txt^\!")") )
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 602px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/16894iCFCB24A869D12FA7/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 08:24:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/using-loop-to-display-a-tab-box-inside-a-tab-box/m-p/193123#M41314</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2019-04-16T08:24:20Z</dc:date>
    </item>
  </channel>
</rss>

