<?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: Make row state handler in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Make-row-state-handler/m-p/755994#M93801</link>
    <description>&lt;P&gt;You will have to somehow remove the old boxes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure if this does what you wish it to do, but I did make quite heavy modifications to your script&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt2 = Open("$SAMPLE_DATA/Iris.jmp", invisible);
dt2 &amp;lt;&amp;lt; Clear Select;

nw = New Window("",
	H List Box(
		Graph Builder(
			Size(653, 571),
			Show Control Panel(0),
			Variables(X(:Sepal length), Y(:Sepal width), Overlay(:Species)),
			Elements(Points(X, Y, Legend(6)))
		),
		Spacer Box(size(10, 0)), 
		Outline Box("Petal Species",
			Spacer Box(size(0, 10)),
			Scroll Box(
				size(350, 150),
				tb_species = Table Box(,&amp;lt;&amp;lt; set selectable rows(0))
			)
		)
	)
);

add_buttons = Function({a},
	selrows = dt2 &amp;lt;&amp;lt; get selected rows;
	
	sel_species = Associative Array(dt2[selrows, "Species"]) &amp;lt;&amp;lt; get keys;
	
	new_colbox = Col Box("Species");
	
	For Each({cur_species, idx}, sel_species,
		new_colbox &amp;lt;&amp;lt; append(
			Button Box(cur_species
				, &amp;lt;&amp;lt; Set Function(function({this},
					New Window("Wikipedia", Web Browser Box("https://en.wikipedia.org/wiki/Iris_" || (this &amp;lt;&amp;lt; get button name)));
				))
				, &amp;lt;&amp;lt; Underline Style(1),
			)
		)
	);
	
	Try(tb_species[ColBox(1)] &amp;lt;&amp;lt; Delete Box());
	tb_species &amp;lt;&amp;lt; append(new_colbox);
);

rs = dt2 &amp;lt;&amp;lt; make row state handler(add_buttons);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 19 May 2024 14:31:32 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-05-19T14:31:32Z</dc:date>
    <item>
      <title>Make row state handler</title>
      <link>https://community.jmp.com/t5/Discussions/Make-row-state-handler/m-p/755955#M93800</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a JSL code to append button boxes for row selection. The problem is that it keeps appending duplicate boxes even if only 1 row is selected. I only want to append 'n' box for 'n' selected rows. If no rows are selected then it should delete all the boxes in the table box&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It added 10 boxes just by selecting 1 row.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Jackie__0-1716125220933.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/64382i583DDA25314E7691/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Jackie__0-1716125220933.png" alt="Jackie__0-1716125220933.png" /&gt;&lt;/span&gt;&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 );

dt2 = Open( "$SAMPLE_DATA/Iris.jmp", invisible );


New Window( "",
	H List Box(
		Graph Builder(
			Size( 653, 571 ),
			Show Control Panel( 0 ),
			Variables( X( :Sepal length ), Y( :Sepal width ), Overlay( :Species ) ),
			Elements( Points( X, Y, Legend( 6 ) ) ),
			SendToReport(
				Dispatch( {}, "Sepal length", ScaleBox, {Min( 4.02451368343195 ), Max( 8.24903846153846 ), Inc( 1 ), Minor Ticks( 0 )} ),
				Dispatch( {}, "Sepal width", ScaleBox, {Min( 1.75 ), Max( 5.00400457665904 ), Inc( 1 ), Minor Ticks( 0 )} )
			)
		),
		Spacer Box( size( 10, 0 ) ), 

		Outline Box( "Petal Species",
			Spacer Box( size( 0, 10 ) ),
			Scroll Box(
				size( 350, 150 ),
				disoi = Table Box(
					colbox = Col Box( "Species" ), 
					//imvinum = Number Col Edit Box( "iMINum", {} ),
				
				)
			),
			disoi &amp;lt;&amp;lt; set selectable rows( 0 ), 
		
			
	
				
		)
	)
);

f = Function( {this},
	dt2 &amp;lt;&amp;lt; begin data update;
	
	list = {};
	
	checnro = N Items( dt2 &amp;lt;&amp;lt; getselectedrows );
	
	For( i = 1, i &amp;lt;= checnro, i++,
		Insert Into( list, dt2:Species[dt2 &amp;lt;&amp;lt; getselectedrows][i] );
		
		
	);

	For Each( {wascc, idx}, list, 
	//For( k = 1, k &amp;lt;= N Items( list ), k++, 
		
		colbox &amp;lt;&amp;lt; append(
		
			Eval(
				Parse(
					"ex" || Char( idx ) ||
					" = Button Box( wascc
					, 
			
				
				New Window( \!"Wikipedia\!",
					&amp;lt;&amp;lt;Type( \!"Dialog\!" ), 
					li"
					 || Char( idx ) || "= ex" || Char( idx ) ||
					"&amp;lt;&amp;lt; Get Button Name();
					Web Browser Box( Char( \!"https://en.wikipedia.org/wiki/Iris_\!" || li" || Char( idx )
					 || ")
					 
					  )
						 
			
				), 
				
				
					
				
				&amp;lt;&amp;lt;Underline Style( 1 );
			
			)"
				)
			)
		)
	); 
			

	
	
	dt2 &amp;lt;&amp;lt; end data update;
	
);
rs = dt2 &amp;lt;&amp;lt; make row state handler( f );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 19 May 2024 13:30:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Make-row-state-handler/m-p/755955#M93800</guid>
      <dc:creator>Jackie_</dc:creator>
      <dc:date>2024-05-19T13:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: Make row state handler</title>
      <link>https://community.jmp.com/t5/Discussions/Make-row-state-handler/m-p/755994#M93801</link>
      <description>&lt;P&gt;You will have to somehow remove the old boxes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure if this does what you wish it to do, but I did make quite heavy modifications to your script&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt2 = Open("$SAMPLE_DATA/Iris.jmp", invisible);
dt2 &amp;lt;&amp;lt; Clear Select;

nw = New Window("",
	H List Box(
		Graph Builder(
			Size(653, 571),
			Show Control Panel(0),
			Variables(X(:Sepal length), Y(:Sepal width), Overlay(:Species)),
			Elements(Points(X, Y, Legend(6)))
		),
		Spacer Box(size(10, 0)), 
		Outline Box("Petal Species",
			Spacer Box(size(0, 10)),
			Scroll Box(
				size(350, 150),
				tb_species = Table Box(,&amp;lt;&amp;lt; set selectable rows(0))
			)
		)
	)
);

add_buttons = Function({a},
	selrows = dt2 &amp;lt;&amp;lt; get selected rows;
	
	sel_species = Associative Array(dt2[selrows, "Species"]) &amp;lt;&amp;lt; get keys;
	
	new_colbox = Col Box("Species");
	
	For Each({cur_species, idx}, sel_species,
		new_colbox &amp;lt;&amp;lt; append(
			Button Box(cur_species
				, &amp;lt;&amp;lt; Set Function(function({this},
					New Window("Wikipedia", Web Browser Box("https://en.wikipedia.org/wiki/Iris_" || (this &amp;lt;&amp;lt; get button name)));
				))
				, &amp;lt;&amp;lt; Underline Style(1),
			)
		)
	);
	
	Try(tb_species[ColBox(1)] &amp;lt;&amp;lt; Delete Box());
	tb_species &amp;lt;&amp;lt; append(new_colbox);
);

rs = dt2 &amp;lt;&amp;lt; make row state handler(add_buttons);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 19 May 2024 14:31:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Make-row-state-handler/m-p/755994#M93801</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-05-19T14:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: Make row state handler</title>
      <link>https://community.jmp.com/t5/Discussions/Make-row-state-handler/m-p/756007#M93804</link>
      <description>&lt;P&gt;Thanks Jarmo!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is exactly what I want.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRIKE&gt;Can we re-order columns in the table box?&amp;nbsp;&amp;nbsp;&lt;/STRIKE&gt;&amp;nbsp; Nvm I figured it out&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 May 2024 15:48:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Make-row-state-handler/m-p/756007#M93804</guid>
      <dc:creator>Jackie_</dc:creator>
      <dc:date>2024-05-19T15:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Make row state handler</title>
      <link>https://community.jmp.com/t5/Discussions/Make-row-state-handler/m-p/908521#M106705</link>
      <description>&lt;P&gt;If I need the f function to select more points, can I avoid an endless loop?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;rs = dt &amp;lt;&amp;lt; Make Row State Handler( f );

f = Function( {a},
	r = dt &amp;lt;&amp;lt; Get Selected Rows;
	If( N Items( r ) &amp;gt; 0,
		dt &amp;lt;&amp;lt; Go To( :lot );
		dt &amp;lt;&amp;lt; Select Matching Cells();
	);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 19 Oct 2025 21:22:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Make-row-state-handler/m-p/908521#M106705</guid>
      <dc:creator>AdamChoen</dc:creator>
      <dc:date>2025-10-19T21:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: Make row state handler</title>
      <link>https://community.jmp.com/t5/Discussions/Make-row-state-handler/m-p/908550#M106708</link>
      <description>&lt;P&gt;One option is to add few extra checks:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;New rows have been selected (and possibly that new values have been selected)&lt;/LI&gt;
&lt;LI&gt;And that the selection wasn't done by &amp;lt;&amp;lt; Select Matching Cells&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;It will still be most likely quite clunky, but it is most likely the best you can get. Better might be to use (Global) Data Filter for the selections.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2025 05:11:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Make-row-state-handler/m-p/908550#M106708</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-10-20T05:11:00Z</dc:date>
    </item>
  </channel>
</rss>

