<?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: Script to ask for User input when using &amp;quot;Create Excel Workbook&amp;quot; in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Script-to-ask-for-User-input-when-using-quot-Create-Excel/m-p/400417#M65152</link>
    <description>&lt;P&gt;Here is a very simple example.&amp;nbsp; It contains minimal formatting, no exception coding etc.&amp;nbsp; You need to read the Scripting Guide.&amp;nbsp; You may find it more convenient to develop your code using Dashboard Builder or Application Builder.&amp;nbsp; But most importantly, you need to spend the time reading about JSL, so you can learn to solve the simple problems like this one&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
nw = New Window( "Enter",
	&amp;lt;&amp;lt;modal,
	H List Box(
		Text Box( "Enter name for Excel Tab" ),
		Spacer Box( size( 10, 0 ) ),
		theInput =
		Text Edit Box( "",
			&amp;lt;&amp;lt;setwidth( 100 ),
			&amp;lt;&amp;lt;set script(
				theName = theInput &amp;lt;&amp;lt; get text
			)
		)
	)
);

Create Excel Workbook( "c:/results.xlsx", theName );&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 12 Jul 2021 23:12:30 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2021-07-12T23:12:30Z</dc:date>
    <item>
      <title>Script to ask for User input when using "Create Excel Workbook"</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-ask-for-User-input-when-using-quot-Create-Excel/m-p/400401#M65149</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When using "Create Excel Workbook" to export a table to Excel, is there a way to ask the User (possibly via a pop-up window) to input the name that should be used for the Excel tab?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Create Excel Workbook&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;"c:/results.xlsx"&lt;SPAN&gt;,{dtFINAL},{&lt;/SPAN&gt;"&lt;FONT color="#FF0000"&gt;ASK FOR&amp;nbsp;USER INPUT&lt;/FONT&gt;"&lt;SPAN&gt;});&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 19:52:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-ask-for-User-input-when-using-quot-Create-Excel/m-p/400401#M65149</guid>
      <dc:creator>EH1</dc:creator>
      <dc:date>2023-06-09T19:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: Script to ask for User input when using "Create Excel Workbook"</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-ask-for-User-input-when-using-quot-Create-Excel/m-p/400417#M65152</link>
      <description>&lt;P&gt;Here is a very simple example.&amp;nbsp; It contains minimal formatting, no exception coding etc.&amp;nbsp; You need to read the Scripting Guide.&amp;nbsp; You may find it more convenient to develop your code using Dashboard Builder or Application Builder.&amp;nbsp; But most importantly, you need to spend the time reading about JSL, so you can learn to solve the simple problems like this one&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
nw = New Window( "Enter",
	&amp;lt;&amp;lt;modal,
	H List Box(
		Text Box( "Enter name for Excel Tab" ),
		Spacer Box( size( 10, 0 ) ),
		theInput =
		Text Edit Box( "",
			&amp;lt;&amp;lt;setwidth( 100 ),
			&amp;lt;&amp;lt;set script(
				theName = theInput &amp;lt;&amp;lt; get text
			)
		)
	)
);

Create Excel Workbook( "c:/results.xlsx", theName );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Jul 2021 23:12:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-ask-for-User-input-when-using-quot-Create-Excel/m-p/400417#M65152</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-07-12T23:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Script to ask for User input when using "Create Excel Workbook"</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-ask-for-User-input-when-using-quot-Create-Excel/m-p/400436#M65153</link>
      <description>&lt;P&gt;Hi Txnelson - thank you for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The text box pop-up works for me, but it will not save the user inputed name to an Excel tab (and the Excel tab is not even created). &amp;nbsp;I believe I need to incorporate "dtFINAL" in the "Create Excel Worksheet" script somehow as that is the table I want to save in an Excel tab. &amp;nbsp;This is my full script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Set Default Directory ( "c:/");
 
dt = Open ("616641_US JTBD Final.jmp");
 
md = dt &amp;lt;&amp;lt; MaxDiff(
       One Table( 1 ),
       Subject ID( :Subject ID ),
       Choice Set ID( :Choice Set ID ),
       Profile ID( :Response Indicator ),
       Profile Effects( :"Profile ID (Milkshake)"n ),
       Response Value Indicates Best( 1 ),
       Response Value Indicates Worst( -1 )
);
 
md &amp;lt;&amp;lt; Save Utility Formula;
md &amp;lt;&amp;lt; close window;
 
tb = dt &amp;lt;&amp;lt; Tabulate(
       Add Table(
              Column Table( Analysis Columns( :Utility Formula ), Statistics( Mean, N ) ),
              Row Table( Grouping Columns( :"Profile ID (Milkshake)"n ) )
       )
);
 
tb &amp;lt;&amp;lt; Make Into Data Table;
dtFINAL = Current Data Table ();
tb &amp;lt;&amp;lt; close window;

//Script from TxNelson
Names Default To Here( 1 );
nw = New Window( "Enter",
	&amp;lt;&amp;lt;modal,
	H List Box(
		Text Box( "Enter name for Excel Tab" ),
		Spacer Box( size( 10, 0 ) ),
		theInput =
		Text Edit Box( "",
			&amp;lt;&amp;lt;setwidth( 100 ),
			&amp;lt;&amp;lt;set script(
				theName = theInput &amp;lt;&amp;lt; get text
			)
		)
	)
);

// This portion doesn't work
Create Excel Workbook( "c:/results.xlsx", theName );

Close (dtFINAL, nosave);

Data Table( "616641_US JTBD Final" ) &amp;lt;&amp;lt; Delete Columns( :Utility Formula );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Jul 2021 00:04:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-ask-for-User-input-when-using-quot-Create-Excel/m-p/400436#M65153</guid>
      <dc:creator>EH1</dc:creator>
      <dc:date>2021-07-13T00:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: Script to ask for User input when using "Create Excel Workbook"</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-ask-for-User-input-when-using-quot-Create-Excel/m-p/400451#M65154</link>
      <description>&lt;P&gt;My error.&lt;/P&gt;
&lt;P&gt;As shown in the Scripting Index for the Create Excel Workbook, both the data table(s) to be used and the name of the tab(s) in the Excel workbook need to be specified, and they both need to be entered as JMP lists.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt1 = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt2 = Open( "$SAMPLE_DATA/Abrasion.jmp" );
Create Excel Workbook(
	"$TEMP/MyWorkbook.xlsx",
	{dt1, dt2},
	{"Big", "Abrasive"}
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; You can specify the dtFinal data table reference by hard coding it as&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;{dtFinal}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but you will need to create a new list to hold the name entered by the user.&amp;nbsp; You will want to use something like&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;theList = {};
insert into(theList, theName);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and then specify the chard code dtFinal and theList values into the Save Excel Workbook() function call.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jul 2021 01:25:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-ask-for-User-input-when-using-quot-Create-Excel/m-p/400451#M65154</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-07-13T01:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: Script to ask for User input when using "Create Excel Workbook"</title>
      <link>https://community.jmp.com/t5/Discussions/Script-to-ask-for-User-input-when-using-quot-Create-Excel/m-p/400493#M65160</link>
      <description>&lt;P&gt;Thank you, &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;!! &amp;nbsp;That worked perfectly!! &amp;nbsp;:)&lt;/img&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jul 2021 11:25:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Script-to-ask-for-User-input-when-using-quot-Create-Excel/m-p/400493#M65160</guid>
      <dc:creator>EH1</dc:creator>
      <dc:date>2021-07-13T11:25:13Z</dc:date>
    </item>
  </channel>
</rss>

