<?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: Nested loops with List boxes in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Nested-loops-with-List-boxes/m-p/461879#M70672</link>
    <description>&lt;P&gt;I believe this is what you want&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1645117298204.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40075iEA60162E2D229281/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1645117298204.png" alt="txnelson_0-1645117298204.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;vlb = V List Box();

For( row = 1, row &amp;lt;= 2, row++,
	hlb = H List Box();
	For( col = 1, col &amp;lt;= 2, col++,
		hlb &amp;lt;&amp;lt; append( Text Box( "Row: " || Char( row ) || ", Col: " || Char( col ) ) )
	);
	vlb &amp;lt;&amp;lt; append( hlb );
);
New Window( "show", vlb &amp;lt;&amp;lt; get picture );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Feb 2022 17:02:03 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2022-02-17T17:02:03Z</dc:date>
    <item>
      <title>Nested loops with List boxes</title>
      <link>https://community.jmp.com/t5/Discussions/Nested-loops-with-List-boxes/m-p/461858#M70671</link>
      <description>&lt;P&gt;I am trying to construct a 2D-matrix with 2 nested FOR-loops used in the mouse over hover labels (Graph builder -&amp;gt; Hover Label Editor -&amp;gt; Graphlet).&lt;/P&gt;&lt;P&gt;I provide here a simplified example for 2*2 matrix.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;hlb  = H List Box();
vlb  = V List Box();

For (row=1, row&amp;lt;=2, row++,
	For (col=1, col&amp;lt;=2, col++,
		hlb &amp;lt;&amp;lt; append(Text Box("Row: "|| char(row) ||", Col: "|| char(col) ))
		);
	vlb &amp;lt;&amp;lt; append(hlb);
);
vlb &amp;lt;&amp;lt; get picture;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Script above results to wrong output:&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="JanneI_0-1645115699038.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40073i2BBACD1B66704C7C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JanneI_0-1645115699038.png" alt="JanneI_0-1645115699038.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To get correct outcome, I need somehow reset the H List Box. However, if I add&amp;nbsp;hlb &amp;lt;&amp;lt; Set Items({}); like below, the outcome is very same as above (ie. not correct).&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;hlb  = H List Box();
vlb  = V List Box();

For (row=1, row&amp;lt;=2, row++,
	For (col=1, col&amp;lt;=2, col++,
		hlb &amp;lt;&amp;lt; append(Text Box("Row: "|| char(row) ||", Col: "|| char(col) ))
		);
	vlb &amp;lt;&amp;lt; append(hlb);
	&lt;FONT color="#FF0000"&gt;hlb &amp;lt;&amp;lt; Set Items({});&lt;/FONT&gt;
);
vlb &amp;lt;&amp;lt; get picture;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I also tried to delete and recreate the H List Box as below. This does not work either as it deletes the H List Box object already fed in to V List Box&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;hlb  = H List Box();
vlb  = V List Box();

For (row=1, row&amp;lt;=2, row++,
	For (col=1, col&amp;lt;=2, col++,
		hlb &amp;lt;&amp;lt; append(Text Box("Row: "|| char(row) ||", Col: "|| char(col) ))
		);
	vlb &amp;lt;&amp;lt; append(hlb);
&lt;FONT color="#FF0000"&gt;	hlb &amp;lt;&amp;lt; Delete;
	hlb  = H List Box();&lt;/FONT&gt;
);
vlb &amp;lt;&amp;lt; get picture;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any further advices? My JMP version is 16.2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks;&lt;/P&gt;&lt;P&gt;Janne&lt;/P&gt;</description>
      <pubDate>Sun, 11 Jun 2023 11:21:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Nested-loops-with-List-boxes/m-p/461858#M70671</guid>
      <dc:creator>JanneI</dc:creator>
      <dc:date>2023-06-11T11:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: Nested loops with List boxes</title>
      <link>https://community.jmp.com/t5/Discussions/Nested-loops-with-List-boxes/m-p/461879#M70672</link>
      <description>&lt;P&gt;I believe this is what you want&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="txnelson_0-1645117298204.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40075iEA60162E2D229281/image-size/medium?v=v2&amp;amp;px=400" role="button" title="txnelson_0-1645117298204.png" alt="txnelson_0-1645117298204.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;vlb = V List Box();

For( row = 1, row &amp;lt;= 2, row++,
	hlb = H List Box();
	For( col = 1, col &amp;lt;= 2, col++,
		hlb &amp;lt;&amp;lt; append( Text Box( "Row: " || Char( row ) || ", Col: " || Char( col ) ) )
	);
	vlb &amp;lt;&amp;lt; append( hlb );
);
New Window( "show", vlb &amp;lt;&amp;lt; get picture );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 17:02:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Nested-loops-with-List-boxes/m-p/461879#M70672</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-02-17T17:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: Nested loops with List boxes</title>
      <link>https://community.jmp.com/t5/Discussions/Nested-loops-with-List-boxes/m-p/461881#M70673</link>
      <description>&lt;P&gt;You could also use Table Box or Lineup Box with N Col:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

vlb = V List Box();

For(row = 1, row &amp;lt;= 2, row++,
	hlb = H List Box();
	For(col = 1, col &amp;lt;= 2, col++,
		hlb &amp;lt;&amp;lt; append(Text Box("Row: " || Char(row) || ", Col: " || Char(col) || " || "))
	);
	vlb &amp;lt;&amp;lt; append(hlb);
);

lb = Lineup Box(N Col(2));

cols = 2;
rows = 2;
For(i = 1, i &amp;lt;= cols * rows, i++,
	row = Ceiling(i / 2);
	col = !Modulo(i, 2) + 1; //just some calculation which works in this case
	Show(col);
	lb &amp;lt;&amp;lt; append(Text Box("Row: " || Char(row) || ", Col: " || Char(col) || " || "));
);

//one option
tb = Table Box("",
	String Col Box("row1", {"Row: 1", "Row: 2"}),
	String Col Box("col1", {"Col: 1", "Col: 1"}),
	String Col Box("row1", {"Row: 1", "Row: 2"}),
	String Col Box("col1", {"Col: 2", "Col: 2"}),
);

New Window("",
	Lineup Box(N Col(1), 
		Text Box("V List Box"), 
		vlb,
		Text Box("Lineup"), 
		lb,
		Text Box("Table Box"), 
		tb
	)
);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Feb 2022 17:14:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Nested-loops-with-List-boxes/m-p/461881#M70673</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-02-17T17:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: Nested loops with List boxes</title>
      <link>https://community.jmp.com/t5/Discussions/Nested-loops-with-List-boxes/m-p/461908#M70677</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jim: Thanks for your solution. It works well. I see now why my trials were not successful.&lt;/P&gt;&lt;P&gt;Jarmo: Thanks for your suggestion for alternative solution to use&amp;nbsp;&lt;SPAN&gt;Table Box or Lineup Box; very educative.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Janne&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 18:04:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Nested-loops-with-List-boxes/m-p/461908#M70677</guid>
      <dc:creator>JanneI</dc:creator>
      <dc:date>2022-02-17T18:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: Nested loops with List boxes</title>
      <link>https://community.jmp.com/t5/Discussions/Nested-loops-with-List-boxes/m-p/461936#M70682</link>
      <description>&lt;P&gt;I wonder if a Line Up Box would be a better approach?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 21:00:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Nested-loops-with-List-boxes/m-p/461936#M70682</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2022-02-17T21:00:59Z</dc:date>
    </item>
  </channel>
</rss>

