<?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 execute a portion of a script based on USER selection on a pop out box in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-execute-a-portion-of-a-script-based-on-USER-selection-on/m-p/55130#M31171</link>
    <description>&lt;P&gt;I have a follow-up question.&lt;/P&gt;&lt;P&gt;Now what I want is the option box to remain open even after making a selection so that I can make another choice if I want to.&lt;/P&gt;&lt;P&gt;How can I script it in shuch a way that dialog box closes only when I cancel?&lt;/P&gt;</description>
    <pubDate>Mon, 16 Apr 2018 22:49:02 GMT</pubDate>
    <dc:creator>888kk888</dc:creator>
    <dc:date>2018-04-16T22:49:02Z</dc:date>
    <item>
      <title>How to execute a portion of a script based on USER selection on a pop out box</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-execute-a-portion-of-a-script-based-on-USER-selection-on/m-p/54712#M30928</link>
      <description>&lt;P&gt;Hi,&amp;nbsp; I have a really basic question:&amp;nbsp; I am running the following script but I want to have a user interface that allows the user to select an option.&amp;nbsp; Based on the option that is selected, a portion of the script is run.&amp;nbsp; Can you kindly help with that or refer to an example which I can use in my script.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is the not the complete script, it is just to highlight that the script has multiple portions, some are just Overlay plots and some summaries or joining. I want to know how to can I execute portion of a script if a specific option is selected by the user and how to end this if user cancels or clicks on "x" on the pop-up window.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//***********
overlayPlot = {"ByTestHead","ByDuts","EntireFleetOn1Dut" };
 
 
Options = new window("Overlay Plot",&amp;lt;&amp;lt;modal,
                    Text box("Choose Overlay Plot Type", &amp;lt;&amp;lt;set width (180)),
                    cb1 = combo Box( overlayPlot ),
             h list box(
                    Button Box( "OK"),
                    Button Box( "Cancel")
       ),
);
 
//Cancel script if Cancel Button selected
BB = Options["Button"];
if(BB==-1, throw(),);
 
 
//If "ByDuts" is slected by user run this section
 
 //***********Overlay By DUT**************
 
      
jrnl1= Overlay Plot(
       X( :Name( "Min(X)" ) ),
       Y( :Name( "Min(Y)" ) ),
       Grouping( :DUT ),
       Overlay Groups( Group[1] &amp;lt;&amp;lt; Group Color( 32 ) &amp;lt;&amp;lt; Group Marker( 0 ) ),
       SendToReport(
             Dispatch( {}, "Overlay Plot", OutlineBox, {Set Title( "This one" )} ),
             Dispatch(
                    {},
                    "Overlay Plot Graph",
                    FrameBox( 14 ),
                    {Frame Size( 660, 570 )}
             ),
             Dispatch(
                    {},
                    "",
                    LegendBox,
                    {Set Title( "Groups" ), Orientation( "Vertical" )}
             )
       )
);
 
jrnl1 &amp;lt;&amp;lt;journal;
 
//If "ByTestHead" is slected by user run this section
//**************By Test Head******************
 
 
jrnl2= Overlay Plot(
       X( :Name( "Min(X)" ) ),
       Y( :Name( "Min(Y)" ) ),
       Grouping( :DUT ),
       Overlay Groups( Group[1] &amp;lt;&amp;lt; Group Color( 32 ) &amp;lt;&amp;lt; Group Marker( 0 ) ),
       SendToReport(
             Dispatch( {}, "Overlay Plot", OutlineBox, {Set Title( "This one" )} ),
             Dispatch(
                    {},
                    "Overlay Plot Graph",
                    FrameBox( 14 ),
                    {Frame Size( 660, 570 )}
             ),
             Dispatch(
                    {},
                    "",
                    LegendBox,
                    {Set Title( "Groups" ), Orientation( "Vertical" )}
             )
       )
);
 
jrnl2 &amp;lt;&amp;lt;journal;
 
 
 
//If "EntireFleetOn1Dut" is slected by user run this section
//*****************By DiePin Burn Count**************
 
 
kb4=Data Table( "damagehistory" );
kb4&amp;lt;&amp;lt; Summary(
       Group( :DiePin ),
       Freq( "None" ),
       Weight( "None" ),
       output table name( "DiePinBurnCount" )
);
 
kb5=Data Table( "Dutref" );
kb5 &amp;lt;&amp;lt; Join(
       With( Data Table( "DiePinBurnCount" ) ),
       Select( :DiePin, :Name( "Min(X)" ), :Name( "Min(Y)" ) ),
       SelectWith( :N Rows ),
       By Matching Columns( :DiePin = :DiePin ),
       Drop multiples( 0, 0 ),
       Include Nonmatches( 1, 1 ),
       Preserve main table order( 1 ),
       Output Table( "OverlayByDiePinBurn" )
);
kb6=Data Table ("OverlayByDiePinBurn");
 
kb6 &amp;lt;&amp;lt;New Column("# of Times Failing", Numeric, "Continuous", Format("Best", 12), Formula(If(Is Missing(:N Rows), 0, :N Rows)));
 
Overlay Plot(
       X( :Name( "Min(X)" ) ),
       Y( :Name( "Min(Y)" ) ),
       Grouping( :Name( "# of Times Failing" ) ),
       Overlay Groups(
             Group[1] &amp;lt;&amp;lt; Group Color( 80 ) &amp;lt;&amp;lt; Group Marker( 0 ),
             Group[2] &amp;lt;&amp;lt; Group Color( 80 ),
             Group[3] &amp;lt;&amp;lt; Group Color( 73 ),
             Group[4] &amp;lt;&amp;lt; Group Color( 73 ),
             Group[5] &amp;lt;&amp;lt; Group Color( 73 ),
             Group[6] &amp;lt;&amp;lt; Group Color( 73 ),
             Group[7] &amp;lt;&amp;lt; Group Color( 73 ),
             Group[8] &amp;lt;&amp;lt; Group Color( 70 ),
             Group[9] &amp;lt;&amp;lt; Group Color( 70 ),
             Group[10] &amp;lt;&amp;lt; Group Color( 70 ),
             Group[11] &amp;lt;&amp;lt; Group Color( 70 ),
             Group[12] &amp;lt;&amp;lt; Group Color( 70 ),
             Group[13] &amp;lt;&amp;lt; Group Color( 70 ),
             Group[14] &amp;lt;&amp;lt; Group Color( 70 ),
             Group[15] &amp;lt;&amp;lt; Group Color( 38 ),
             Group[16] &amp;lt;&amp;lt; Group Color( 38 ),
             Group[17] &amp;lt;&amp;lt; Group Color( 38 ),
             Group[18] &amp;lt;&amp;lt; Group Color( 35 ),
             Group[19] &amp;lt;&amp;lt; Group Color( 3 ),
             Group[20] &amp;lt;&amp;lt; Group Color( 3 ),
             Group[21] &amp;lt;&amp;lt; Group Color( 19 ),
             Group[22] &amp;lt;&amp;lt; Group Color( 19 ),
             Group[23] &amp;lt;&amp;lt; Group Color( 51 ),
             Group[24] &amp;lt;&amp;lt; Group Color( 51 )
       ),
       SendToReport(
             Dispatch( {}, "Overlay Plot", OutlineBox, {Set Title( "What else" )} ),
             Dispatch(
                    {},
                    "Overlay Plot Graph",
                    FrameBox( 25 ),
                    {Frame Size( 719, 632 )}
             ),
             Dispatch(
                    {},
                    "",
                    LegendBox,
                    {Set Title( "Groups" ), Orientation( "Vertical" )}
             )
       )
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 07:44:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-execute-a-portion-of-a-script-based-on-USER-selection-on/m-p/54712#M30928</guid>
      <dc:creator>888kk888</dc:creator>
      <dc:date>2018-04-10T07:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to execute a portion of a script based on USER selection on a pop out box</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-execute-a-portion-of-a-script-based-on-USER-selection-on/m-p/54722#M30934</link>
      <description>&lt;P&gt;Hi. I have a simple recommendation: use expressions to store portions of your script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expressions can be entire scripts. Another option is to use Include() files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You did not say which version of JMP you are using. I attached two scripts, one for version 12 and another for version 13, that selects different expressions. The one for version 12 might also work on version 11.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These scripts prompt the user and runs different expressions based upon user input or cancel. The Expressions are simple caption boxes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 23:37:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-execute-a-portion-of-a-script-based-on-USER-selection-on/m-p/54722#M30934</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2018-04-09T23:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to execute a portion of a script based on USER selection on a pop out box</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-execute-a-portion-of-a-script-based-on-USER-selection-on/m-p/54730#M30941</link>
      <description>&lt;P&gt;You might want to look at this blogpost:&amp;nbsp;&lt;A href="https://community.jmp.com/t5/JMPer-Cable/How-to-create-a-JMP-user-interface-using-display-boxes-in-JSL/ba-p/44034" target="_blank"&gt;https://community.jmp.com/t5/JMPer-Cable/How-to-create-a-JMP-user-interface-using-display-boxes-in-JSL/ba-p/44034&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Much more info about user interfaces in JMP is of course provided in the JMP Scripting Guide (in JMP go to the main menu =&amp;gt; Help =&amp;gt; Books =&amp;gt; Scripting Guide). You will be interested in chapter 11 "Display Trees".&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a very simple example in JSL:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// User Interface using radio buttons
ui = New Window( "Chose an option",
	&amp;lt;&amp;lt;Modal,
	user choice box = Radio Box( {"A", "B"} ),
	Button Box( "Ok", user choice = user choice box &amp;lt;&amp;lt; Get Selected ) // The second argument is executed when the user presses the "OK"-button
);

// Now do something depending on the users choice
If( user choice == "A",
	New Window( "Result", Text Box( "You chose A!" ) ),
	New Window( "Result", Text Box( "You chose B!" ) )
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 09:36:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-execute-a-portion-of-a-script-based-on-USER-selection-on/m-p/54730#M30941</guid>
      <dc:creator>shoffmeister</dc:creator>
      <dc:date>2018-04-10T09:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to execute a portion of a script based on USER selection on a pop out box</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-execute-a-portion-of-a-script-based-on-USER-selection-on/m-p/54807#M30973</link>
      <description>&lt;P&gt;thanks a lot Guys. Both were very helpful.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 23:06:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-execute-a-portion-of-a-script-based-on-USER-selection-on/m-p/54807#M30973</guid>
      <dc:creator>888kk888</dc:creator>
      <dc:date>2018-04-10T23:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to execute a portion of a script based on USER selection on a pop out box</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-execute-a-portion-of-a-script-based-on-USER-selection-on/m-p/55130#M31171</link>
      <description>&lt;P&gt;I have a follow-up question.&lt;/P&gt;&lt;P&gt;Now what I want is the option box to remain open even after making a selection so that I can make another choice if I want to.&lt;/P&gt;&lt;P&gt;How can I script it in shuch a way that dialog box closes only when I cancel?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Apr 2018 22:49:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-execute-a-portion-of-a-script-based-on-USER-selection-on/m-p/55130#M31171</guid>
      <dc:creator>888kk888</dc:creator>
      <dc:date>2018-04-16T22:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to execute a portion of a script based on USER selection on a pop out box</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-execute-a-portion-of-a-script-based-on-USER-selection-on/m-p/55138#M31176</link>
      <description>&lt;P&gt;Here is a very simple example using a Radio Box. Depending upon the user selection values are added to a table.&lt;/P&gt;&lt;P&gt;The &amp;lt;&amp;lt;set function is run whenever a selection is made. In this example, the user can select the same button may times.&lt;/P&gt;&lt;P&gt;"this" refers to the display box object.&amp;nbsp; Sending a message to "this" must be a valid message for a radio box.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is likely that your example is a menu of options. You can add buttons and items to a JMP platform window.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
testTable = new Table("get values", New Column("User Selections", numeric));
New Window( "Example",
	Radio Box({"press one", "press two", "press 3"},
		&amp;lt;&amp;lt;setFunction(
			Function(
				{this/* functions specified with SetFunction get 'this' display box */
				}, {_xx, nr}, //local values
				_xx = choose(this &amp;lt;&amp;lt; get, Random Integer(1,10), 100*Random Integer(1,3),
				 Ceiling(1000*(Random Uniform())));
				 testTable &amp;lt;&amp;lt; Add Row(1);
				 nr = nrow(testTable);
				 :User Selections[nr]=_xx
			)
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The dialog box persists, but it is not modal, meaning it does not lock out other JMP actions while it is open.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope you find this example informative.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 09:19:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-execute-a-portion-of-a-script-based-on-USER-selection-on/m-p/55138#M31176</guid>
      <dc:creator>gzmorgan0</dc:creator>
      <dc:date>2018-04-17T09:19:38Z</dc:date>
    </item>
  </channel>
</rss>

