cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP Security Notice: CVE-2026-109618 and CVE-2026-109619

    JMP promptly initiated a review of its products, services, and relevant infrastructure for exposure to CVE-2026-109618 and CVE-2026-109619.

    Our assessment of JMP products has not identified exposure to these vulnerabilities. Where remediation was required within supporting environments, appropriate security updates and controls have been applied and validated.

    We have identified no evidence of successful exploitation or unauthorized access to JMP systems or customer information associated with these vulnerabilities.

    JMP continues to monitor the issue and relevant vendor guidance. No action is required by JMP customers at this time.

  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
EH1
EH1
Level III

Script to ask for User input when using "Create Excel Workbook"

Hi,

 

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?

 

Create Excel Workbook ("c:/results.xlsx",{dtFINAL},{"ASK FOR USER INPUT"});

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Script to ask for User input when using "Create Excel Workbook"

My error.

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.

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"}
);

  You can specify the dtFinal data table reference by hard coding it as

{dtFinal}

but you will need to create a new list to hold the name entered by the user.  You will want to use something like 

theList = {};
insert into(theList, theName);

and then specify the chard code dtFinal and theList values into the Save Excel Workbook() function call.

 

Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: Script to ask for User input when using "Create Excel Workbook"

Here is a very simple example.  It contains minimal formatting, no exception coding etc.  You need to read the Scripting Guide.  You may find it more convenient to develop your code using Dashboard Builder or Application Builder.  But most importantly, you need to spend the time reading about JSL, so you can learn to solve the simple problems like this one

Names Default To Here( 1 );
nw = New Window( "Enter",
	<<modal,
	H List Box(
		Text Box( "Enter name for Excel Tab" ),
		Spacer Box( size( 10, 0 ) ),
		theInput =
		Text Edit Box( "",
			<<setwidth( 100 ),
			<<set script(
				theName = theInput << get text
			)
		)
	)
);

Create Excel Workbook( "c:/results.xlsx", theName );
Jim
EH1
EH1
Level III

Re: Script to ask for User input when using "Create Excel Workbook"

Hi Txnelson - thank you for your help!

 

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).  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.  This is my full script:

 

Set Default Directory ( "c:/");
 
dt = Open ("616641_US JTBD Final.jmp");
 
md = dt << 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 << Save Utility Formula;
md << close window;
 
tb = dt << Tabulate(
       Add Table(
              Column Table( Analysis Columns( :Utility Formula ), Statistics( Mean, N ) ),
              Row Table( Grouping Columns( :"Profile ID (Milkshake)"n ) )
       )
);
 
tb << Make Into Data Table;
dtFINAL = Current Data Table ();
tb << close window;

//Script from TxNelson
Names Default To Here( 1 );
nw = New Window( "Enter",
	<<modal,
	H List Box(
		Text Box( "Enter name for Excel Tab" ),
		Spacer Box( size( 10, 0 ) ),
		theInput =
		Text Edit Box( "",
			<<setwidth( 100 ),
			<<set script(
				theName = theInput << get text
			)
		)
	)
);

// This portion doesn't work
Create Excel Workbook( "c:/results.xlsx", theName );

Close (dtFINAL, nosave);

Data Table( "616641_US JTBD Final" ) << Delete Columns( :Utility Formula );
txnelson
Super User

Re: Script to ask for User input when using "Create Excel Workbook"

My error.

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.

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"}
);

  You can specify the dtFinal data table reference by hard coding it as

{dtFinal}

but you will need to create a new list to hold the name entered by the user.  You will want to use something like 

theList = {};
insert into(theList, theName);

and then specify the chard code dtFinal and theList values into the Save Excel Workbook() function call.

 

Jim
EH1
EH1
Level III

Re: Script to ask for User input when using "Create Excel Workbook"

Thank you, @txnelson!!  That worked perfectly!!  :)

Recommended Articles