<?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: Creating a GUI with Checkboxes to Trigger File Selection and Data Formatting Functions in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Creating-a-GUI-with-Checkboxes-to-Trigger-File-Selection-and/m-p/804600#M98227</link>
    <description>&lt;P&gt;You can use &amp;lt;&amp;lt; get selected to get the selected items (or &amp;lt;&amp;lt; get selected indices if you just want the indices and not values). Then loop over the selection list and perform the actions&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

nw = New Window("Example",
	cb = Check Box(
		{"One", "Two", "Three"}
	),
	Button Box("Go",
		For Each({sel}, cb &amp;lt;&amp;lt; get selected,
			Match(sel,
				"One", Show("FIRST"),
				"Two", Show("SECOND"),
				"Three", Show("THIRD")
			);
		);
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://www.jmp.com/support/help/en/17.2/#page/jmp/construct-display-boxes-for-new-windows.shtml#ww196934" target="_blank"&gt;Construct Display Boxes for New Windows (jmp.com)&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Oct 2024 04:38:32 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-10-10T04:38:32Z</dc:date>
    <item>
      <title>Creating a GUI with Checkboxes to Trigger File Selection and Data Formatting Functions</title>
      <link>https://community.jmp.com/t5/Discussions/Creating-a-GUI-with-Checkboxes-to-Trigger-File-Selection-and/m-p/804590#M98226</link>
      <description>&lt;P&gt;am developing a graphical user interface (GUI) that allows users to select one or more options via checkboxes. For each selected option, the GUI should perform the following actions sequentially:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;Pick File:&lt;/STRONG&gt; Open a file picker dialog to allow the user to select a specific file related to the chosen option.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Format and Save:&lt;/STRONG&gt; Process the selected file using a predefined function that formats the data and saves the changes.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Nedd help:&lt;/P&gt;&lt;P&gt;I need help handling scenarios where multiple checkboxes are selected simultaneously, ensuring that each selected option independently triggers its associated functions without conflicts.&lt;/P&gt;&lt;P&gt;I'm unsure how to set up event listeners for each checkbox to trigger the corresponding functions when selected.&lt;/P&gt;&lt;P&gt;Outcome&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Users can select one or more options via checkboxes.&lt;/LI&gt;&lt;LI&gt;Upon selection, for each checked box:&lt;UL&gt;&lt;LI&gt;A file picker dialog appears for the user to select the relevant file.&lt;/LI&gt;&lt;LI&gt;The selected file is processed by the formatting function.&lt;/LI&gt;&lt;LI&gt;The formatted data is saved appropriately.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;The GUI remains responsive and provides feedback during and after the operations.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I have attached the code so far with comments where i need help.. also if there is a more elegant solution for gui please share&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&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 );
directory_to_collect_data_table = "/C:/Users/";
data_list = {"datatable_1 ", "datatable_2", "datatable_3"};
userInput_dt = Function( {},
	dt = Pick File(
		"3. Pick Up Data Table_Total#1",
		directory_to_collect_data_table,
		{"JMP Files|jmp;jsl;jrn", "All Files|*"},
		1,
		0,
		"",
		"multiple"
	);
	Return( dt );
);
datatable_1func = Function( {dt},
	dt &amp;lt;&amp;lt; New Column( "label",
		Character,  // The new column will store character values
		Formula(
			"D" || Substitute( :Extracted_Data, "A", "" )  // Prepend "D" and remove "A"
		)
	);
	dt &amp;lt;&amp;lt; Column( "Extracted_Data" ) &amp;lt;&amp;lt; Hide( 1 );
	dt:ROW1 &amp;lt;&amp;lt; Data Type( Character );
	final_data1 = Data Table( "final_data" );
);

// GUI for selecting and merging files
Userinput_1 = New Window( 
		Panel Box( "Select the datatable",
			Check Box( data_list ),
			Button Box( "Select Files", Userinput_1//add functionality
			//add functionality if datatable_1 is selected then call function datatable_1func ( datatable_1 );
			//whichever check box is selected accordingly a function is called 	
			)
		
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Oct 2024 02:58:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creating-a-GUI-with-Checkboxes-to-Trigger-File-Selection-and/m-p/804590#M98226</guid>
      <dc:creator>DecileIbex201</dc:creator>
      <dc:date>2024-10-10T02:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a GUI with Checkboxes to Trigger File Selection and Data Formatting Functions</title>
      <link>https://community.jmp.com/t5/Discussions/Creating-a-GUI-with-Checkboxes-to-Trigger-File-Selection-and/m-p/804600#M98227</link>
      <description>&lt;P&gt;You can use &amp;lt;&amp;lt; get selected to get the selected items (or &amp;lt;&amp;lt; get selected indices if you just want the indices and not values). Then loop over the selection list and perform the actions&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

nw = New Window("Example",
	cb = Check Box(
		{"One", "Two", "Three"}
	),
	Button Box("Go",
		For Each({sel}, cb &amp;lt;&amp;lt; get selected,
			Match(sel,
				"One", Show("FIRST"),
				"Two", Show("SECOND"),
				"Three", Show("THIRD")
			);
		);
	);
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://www.jmp.com/support/help/en/17.2/#page/jmp/construct-display-boxes-for-new-windows.shtml#ww196934" target="_blank"&gt;Construct Display Boxes for New Windows (jmp.com)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 04:38:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creating-a-GUI-with-Checkboxes-to-Trigger-File-Selection-and/m-p/804600#M98227</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-10-10T04:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a GUI with Checkboxes to Trigger File Selection and Data Formatting Functions</title>
      <link>https://community.jmp.com/t5/Discussions/Creating-a-GUI-with-Checkboxes-to-Trigger-File-Selection-and/m-p/804727#M98247</link>
      <description>&lt;P&gt;You can associate a function with the check box. It is called whenever the user interacts with the check box. See Help &amp;gt; Scripting Index:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="check box.png" style="width: 995px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68995i7D8A94A2F349F568/image-size/large?v=v2&amp;amp;px=999" role="button" title="check box.png" alt="check box.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 13:29:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creating-a-GUI-with-Checkboxes-to-Trigger-File-Selection-and/m-p/804727#M98247</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2024-10-10T13:29:06Z</dc:date>
    </item>
  </channel>
</rss>

