<?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: How to use Set Function {self} in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-use-Set-Function-self/m-p/672472#M86016</link>
    <description>&lt;P&gt;Thankyou, it works!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have one small problem my script everytime i click on radio box 5 times, it will open 5 display windows. How to make everytime i click the radio box it will change the current display windows not the open new one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help me to check my script...&lt;/P&gt;&lt;P&gt;Here below i attach the picture of my problem&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//Get the current data Table
Names Default To Here( 1 );
dt = Current Data Table();

columnNames = dt &amp;lt;&amp;lt; Get Column Names( "String" );

cl = New Window( "Column Selection", 
//	&amp;lt;&amp;lt;modal, // optional, probably not what you want
	H List Box(
		Panel Box( "Make a selection",
			allcolumn = Radio Box(
				columnNames,
				&amp;lt;&amp;lt;Set Function(
					Function( {self},
						col = self &amp;lt;&amp;lt; get selected;
						Bivariate(
							Y( :Y ),
							X( :X ),
							By( :WAFER_ID, ),
							SendToReport(
								Dispatch(
									{},
									"Bivar Plot",
									FrameBox,
									{Row Legend(
										Eval( col ),
										Color( 1 ),
										Color Theme( "Spectral"(1) ),
										Marker( 0 ),
										Marker Theme( "" ),
										Continuous Scale( 0 ),
										Reverse Scale( 0 ),
										Excluded Rows( 0 )
									)}
								)
							)
						);
					)
				)
			)
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 30 Aug 2023 08:08:35 GMT</pubDate>
    <dc:creator>mystylelife19</dc:creator>
    <dc:date>2023-08-30T08:08:35Z</dc:date>
    <item>
      <title>How to use Set Function {self}</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-Set-Function-self/m-p/672030#M85989</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I explore all the question and answer inside this community and still not getting my answer to use this script. Can you help me, please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have data table with all the parameter (column) and data (row). My question is how to use Radio Box with the set function {self} to display all the data that i chosen one parameter on Radio Box to see at&amp;nbsp;Bivariate (Fit Y by X).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't want to click OK to see the output on Bivariate, just click parameter on radio box.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attach with example data table below,&lt;/P&gt;&lt;P&gt;Here my full script but still my radio box won't function using set function {self}&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//Get the current data Table
Names Default To Here( 1 );
dt = Current Data Table();

// Get the all column names from the data table
columnNames = dt &amp;lt;&amp;lt; Get Column Names("String");

cl = New Window("Column Selection", &amp;lt;&amp;lt;Modal,
		  Panel Box("Make a selection",
			  allcolumn = RadioBox(columnNames, 
			    &amp;lt;&amp;lt;Set Function(
			    Function({self},
						match(self &amp;lt;&amp;lt; Get Selected,
							allcolumn, columnNames &amp;lt;&amp;lt; Set //i don't know on how to set funtion {self} to all parameter
						)
					)
				)
			)	
		)
	); 

// If cancel or X was clicked, stop the script
If( cl == {Button( -1 )}, Stop() );	

Bivariate(
	Y( :Y ),
	X( :X ),
	By( :WAFER_ID, :SITE_NO ) );
	SendToReport(
		Dispatch(
			{},
			"Bivar Plot",
			FrameBox,
			{Row Legend(
				allcolumn, //this one is referring to the radio box parameter for what i choosing
				Color( 1 ),
				Color Theme( "Spectral"(1) ),
				Marker( 0 ),
				Marker Theme( "" ),
				Continuous Scale( 0 ),
				Reverse Scale( 0 ),
				Excluded Rows( 0 )
			)}
		)
	);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Aug 2023 02:44:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-Set-Function-self/m-p/672030#M85989</guid>
      <dc:creator>mystylelife19</dc:creator>
      <dc:date>2023-08-29T02:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Set Function {self}</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-Set-Function-self/m-p/672181#M85996</link>
      <description>&lt;P&gt;GUI design rules don't usually run code when a radio button is picked. You can break the rule, but users may not like it. This example will let you choose either path&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$sample_data/big class.jmp" );

// Get the all column names from the data table
columnNames = dt &amp;lt;&amp;lt; Get Column Names( "String" );

cl = New Window( "Column Selection",
	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;Return Result, // this is the magic part you are missing
	Panel Box( "Make a selection",
		allcolumn = Radio Box(
			columnNames,
			&amp;lt;&amp;lt;Set Function( // I don't think you want this at all,
				Function( {self}, // but here's an example.
					Match( self &amp;lt;&amp;lt; Get Selected,
						"age", print("you picked age"),
						"height", print("you picked height"),
						"weight", print("you picked weight"),
						print("you picked this:",self&amp;lt;&amp;lt;get selected)
					)
				)
			)
		)
	)
);
// this is what I think you want...
show(columnNames[cl["allcolumn"]]);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;EM&gt;&amp;lt;&amp;lt;return result&lt;/EM&gt; is my preferred way to get the results from the dialog, after &lt;EM&gt;OK&lt;/EM&gt;, and then process them.&lt;/P&gt;
&lt;P&gt;The code that runs when a radio button is clicked usually disables/enables another part of the dialog; you might, for example, change available options when a numeric vs character variable is chosen in the radio list.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2023 14:30:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-Set-Function-self/m-p/672181#M85996</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2023-08-29T14:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Set Function {self}</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-Set-Function-self/m-p/672219#M86000</link>
      <description>&lt;P&gt;Thankyou for reply my question,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry i still don't understand...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actually i want to have the output wafer map that shows based on my click Radio Box. Is it possible to do it?&lt;/P&gt;&lt;P&gt;Because i don't want to click OK everytime i choose the parameter on Radio Box. I want to make the Radio Box stay appear on my screen everytime i click OK or just using self function to see the output on wafer map. I tried to have all the column names with self function but still doesn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to write the self function with all the parameter i have?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also how to make the Bivar Plot, Row Legend based on radio box i choose?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example i want based on my images:&lt;/P&gt;&lt;P&gt;1. Red one is parameter on radio box i choose that make Row Legend on Bivor Plot&lt;/P&gt;&lt;P&gt;2. Blue one is the output i want to see based on row legend i picked on radio box&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2023 16:43:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-Set-Function-self/m-p/672219#M86000</guid>
      <dc:creator>mystylelife19</dc:creator>
      <dc:date>2023-08-29T16:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Set Function {self}</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-Set-Function-self/m-p/672394#M86009</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$sample_data/big class.jmp" );

columnNames = dt &amp;lt;&amp;lt; Get Column Names( "String" );

cl = New Window( "Column Selection",
//	&amp;lt;&amp;lt;modal, // optional, probably not what you want
	H List Box(
		Panel Box( "Make a selection",
			allcolumn = Radio Box(
				columnNames,
				&amp;lt;&amp;lt;Set Function(
					Function( {self},
						col = self &amp;lt;&amp;lt; get selected;
						Try( (reportHolder &amp;lt;&amp;lt; child) &amp;lt;&amp;lt; delete ); // remove old content
						reportholder &amp;lt;&amp;lt; append( dt &amp;lt;&amp;lt; Distribution( Nominal Distribution( Column( Eval( col ) ) ) ) );
					)
				)
			)
		),
		reportHolder = Border Box()
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Aug 2023 23:15:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-Set-Function-self/m-p/672394#M86009</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2023-08-29T23:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Set Function {self}</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-Set-Function-self/m-p/672472#M86016</link>
      <description>&lt;P&gt;Thankyou, it works!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have one small problem my script everytime i click on radio box 5 times, it will open 5 display windows. How to make everytime i click the radio box it will change the current display windows not the open new one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help me to check my script...&lt;/P&gt;&lt;P&gt;Here below i attach the picture of my problem&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//Get the current data Table
Names Default To Here( 1 );
dt = Current Data Table();

columnNames = dt &amp;lt;&amp;lt; Get Column Names( "String" );

cl = New Window( "Column Selection", 
//	&amp;lt;&amp;lt;modal, // optional, probably not what you want
	H List Box(
		Panel Box( "Make a selection",
			allcolumn = Radio Box(
				columnNames,
				&amp;lt;&amp;lt;Set Function(
					Function( {self},
						col = self &amp;lt;&amp;lt; get selected;
						Bivariate(
							Y( :Y ),
							X( :X ),
							By( :WAFER_ID, ),
							SendToReport(
								Dispatch(
									{},
									"Bivar Plot",
									FrameBox,
									{Row Legend(
										Eval( col ),
										Color( 1 ),
										Color Theme( "Spectral"(1) ),
										Marker( 0 ),
										Marker Theme( "" ),
										Continuous Scale( 0 ),
										Reverse Scale( 0 ),
										Excluded Rows( 0 )
									)}
								)
							)
						);
					)
				)
			)
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Aug 2023 08:08:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-Set-Function-self/m-p/672472#M86016</guid>
      <dc:creator>mystylelife19</dc:creator>
      <dc:date>2023-08-30T08:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Set Function {self}</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-Set-Function-self/m-p/672561#M86028</link>
      <description>&lt;P&gt;This was harder to write than it looks, but turned out simpler than I expected.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$sample_data/big class.jmp" );

columnNames = dt &amp;lt;&amp;lt; Get Column Names( "String" );

anchorPoint = Empty(); // no previous window remembered yet

// the report to generate with col which depends on col being global.
// used below, either as Report(...) which makes a new window,
// or &amp;lt;&amp;lt;apend(...) which append to an existing box.
// write the expression once and use it in several places below...
makereport = Expr(
	dt &amp;lt;&amp;lt; Distribution( Nominal Distribution( Column( Eval( col ) ) ) )
);

cl = New Window( "Column Selection",
	H List Box(
		Panel Box( "Make a selection",
			allcolumn = Radio Box(
				columnNames,
				&amp;lt;&amp;lt;Set Function(
					Function( {self},
						col = self &amp;lt;&amp;lt; get selected;
						If( Is Empty( anchorPoint ),
							newReport = Report( makereport );
							anchorPoint = newReport &amp;lt;&amp;lt; TopParent;
						, // else try to reuse the window if it still exists
							(anchorPoint &amp;lt;&amp;lt; child) &amp;lt;&amp;lt; delete; // remove old content
							anchorPoint &amp;lt;&amp;lt; append( makereport ); // add new content
						);
					)
				)
			)
		)
	)
);
// force the item 1 script to run without running the item 2 script
allcolumn &amp;lt;&amp;lt; set( 2, runscript( 0 ) );
allcolumn &amp;lt;&amp;lt; set( 1, runscript( 1 ) );
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Simpler than expected because anchorPoint becomes empty when the window is closed. I was writing several try() blocks to handle closed windows...but didn't need them. Cool! The last two lines at the end are the only way I could find to run the script for the current selection to pre-open a window.&lt;/P&gt;
&lt;P&gt;Anyone reading along: this design might or might not violate a GUI design principle that radio buttons should &lt;EM&gt;select&lt;/EM&gt; something but not &lt;EM&gt;perform&lt;/EM&gt; an action. If you believe the radio button in this application is selecting a variable and showing a visual to help with the selection process, great! But if you think you are using the radio button to perform the analysis, you might be frustrating your users!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 14:31:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-Set-Function-self/m-p/672561#M86028</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2023-08-30T14:31:38Z</dc:date>
    </item>
  </channel>
</rss>

