<?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: User Interface- How to use a Checkbox to run a function in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/User-Interface-How-to-use-a-Checkbox-to-run-a-function/m-p/457889#M70301</link>
    <description>&lt;P&gt;Add two help prints:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Print Final products before first If. I would suggest "printing" it with Show(Final Products)&lt;/LI&gt;
&lt;LI&gt;Add second print inside your for loop for Final_Products[i]&amp;nbsp; before first if inside the loop&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;These might give you a good idea what could be wrong&lt;/P&gt;</description>
    <pubDate>Wed, 02 Feb 2022 19:34:22 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2022-02-02T19:34:22Z</dc:date>
    <item>
      <title>User Interface- How to use a Checkbox to run a function</title>
      <link>https://community.jmp.com/t5/Discussions/User-Interface-How-to-use-a-Checkbox-to-run-a-function/m-p/457869#M70299</link>
      <description>&lt;P&gt;I am attempting to build a UI that asks for the user to select "Products" from a list, and then create a graph of each product and adding "Material" to then graph title based on if the check box is selected or not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far I have my UI window, but I am lost on how to connect it to my graph script. I think something like an If statement may be the key, but I may be wrong.&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 );
dt = Data Table( "untitled 16" );
values = dt:Product &amp;lt;&amp;lt; Get Values;
array = Associative Array( values );
ProductList = array &amp;lt;&amp;lt; Get Keys;
Final Products = {};
// Prompt for the input and create graph
FP = New Window( "Choose the Final Products",
	&amp;lt;&amp;lt;Modal,
	&amp;lt;&amp;lt;return result,
	H List Box( Spacer Box( Size( 10, 30 ) ) ),
	V List Box(
		align( center ),
		Spacer Box( Size( 10, 10 ) ),
		Panel Box( "Select the Final Products", Spacer Box( Size( 10, 10 ) ), checkObj = Check Box( ProductList ), )
	), 

	//If Check box is checked (FP), then add "Material -GPC Overlay" to the title. Otherwise, Add "-GPC Overlay" to the title.
	Button Box( "OK", 
       //script that executes upon clicking "OK"
		keep_going = 1;

		Final_Products = checkObj &amp;lt;&amp;lt; get selected;

	), 

           

);

nt = N Items( Final_Products );

If( keep_going &amp;amp; nt &amp;gt; 0, 

	For( i = 1, i &amp;lt;= nt, i++, 

		If(
			Final_Products[i] == 1, 

//              Call function for One step

				Print( {1} ); // I tried "1" , but I'm missing something here. I am guessing I can insert the graph function here rather than print, but I was using print to check my work.

		, 

			Final_Products[i] == 2, 

//              Call function for Two step

				Print( 2 ); // I tried "2" , but I'm missing something here

 

		);

	);

);
FP &amp;lt;&amp;lt; Close Window;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 18:09:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/User-Interface-How-to-use-a-Checkbox-to-run-a-function/m-p/457869#M70299</guid>
      <dc:creator>Raybob</dc:creator>
      <dc:date>2023-06-09T18:09:59Z</dc:date>
    </item>
    <item>
      <title>Re: User Interface- How to use a Checkbox to run a function</title>
      <link>https://community.jmp.com/t5/Discussions/User-Interface-How-to-use-a-Checkbox-to-run-a-function/m-p/457889#M70301</link>
      <description>&lt;P&gt;Add two help prints:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Print Final products before first If. I would suggest "printing" it with Show(Final Products)&lt;/LI&gt;
&lt;LI&gt;Add second print inside your for loop for Final_Products[i]&amp;nbsp; before first if inside the loop&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;These might give you a good idea what could be wrong&lt;/P&gt;</description>
      <pubDate>Wed, 02 Feb 2022 19:34:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/User-Interface-How-to-use-a-Checkbox-to-run-a-function/m-p/457889#M70301</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-02-02T19:34:22Z</dc:date>
    </item>
  </channel>
</rss>

