Showing results for 
Show  only  | Search instead for 
Did you mean: 
How to create a Recall button on a custom window


When using the JMP® Scripting Language (JSL) to generate a custom window to prompt the user for information, it is often desirable to add a button that restores settings from a previous launch of the window within the same JMP instance. Similar functionality is available when launching a platform interactively, such as by clicking the Analyze menu and selecting Distribution.

Currently, there is no built-in JSL method for creating a Recall button as you see in the Distribution platform launch and Tables menu dialogs. However, you can create your own implementation.

The following example generates a custom window where the user can cast columns from the active data table into appropriate roles. When the OK button is clicked, the user's settings are stored in variables defined in a named namespace. On subsequent launches of the window, the Recall button clears any current settings and restores the values from the namespace.


In a JMP session, click the File menu and select New ► Script. Copy the below script and paste it into the script window. To run the sample script, click the Edit menu and select Run Script.

Names Default to Here(1);

/* Assign dt to reference a table.  Open a sample table for demonstration purposes */
dt = Open("$SAMPLE_DATA/Semiconductor");

/* Use a named namespace to hold the recall values */
if(!Namespace Exists("Custom Dialog"), // define namespace if it does not exist
	dialogRecallNS = New Namespace("Custom Dialog",
		ycolRecall = {},
		orderRecall = {},
		byRecall = {}
, // else get a reference to the existing namespace
	dialogRecallNS = NameSpace("Custom Dialog");

nc = N Col( dt );
lbWidth = 130;

/* Expression to clear all current settings */ 
clearRoles = Expr(
	colListY << RemoveAll;
	colListX << RemoveAll;
	colListB << RemoveAll;

/* Expression to store the current settings in global variables */ 
recallRoles = Expr(
	dialogRecallNS:ycolRecall = colListY << GetItems;
	dialogRecallNS:orderRecall = colListX << GetItems;
	dialogRecallNS:byRecall = colListB << GetItems;

/* Custom Launch Window */ 
customDlg = New Window( "Example of a Custom Dialog",
	Border Box( Left( 3 ), top( 2 ),
		V List Box(
			Text Box( "Example dialog to demonstrate a Recall button" ),
			H List Box(
				V List Box(
					Panel Box( "Select Columns",
						colListData = Col List Box( All, width( lbWidth ), nLines( Min( nc, 10 ) ) )
				Panel Box( "Cast Selected Columns into Roles",
					Lineup Box( N Col( 2 ), Spacing( 3 ),
						Button Box( "Y, Response", colListY << Append( colListData << GetSelected ) ),
						colListY = Col List Box( width( lbWidth ), nLines( 5 ), numeric ),
						Button Box( "X, Factor", colListX << Append( colListData << GetSelected ) ),
						colListX = Col List Box( width( lbWidth ), nLines( 1 ), numeric ),
						Button Box( "By", colListB << Append( colListData << GetSelected ) ),
						colListB = Col List Box( width( lbWidth ), nLines( 1 ) )
				Panel Box( "Action",
					Lineup Box( N Col( 1 ),
						Button Box( "OK",
							customDlg << CloseWindow;
						Button Box( "Cancel", customDlg << CloseWindow ),
						Button Box( "Reset", clearRoles ),
						Text Box( " " ),
						Button Box( "Remove",
							colListY << RemoveSelected;
							colListX << RemoveSelected;
							colListB << RemoveSelected;
						Button Box( "Recall",
							/* Restore any previous settings from the namespace variables */
								colListY << Append( dialogRecallNS:ycolRecall );
								colListX << Append( dialogRecallNS:orderRecall );
								colListB << Append( dialogRecallNS:byRecall );

Additional Documentation

More information about the JMP Scripting Language can be found in the JMP Scripting Guide. You can access the guide from within JMP by clicking on the Help menu and select JMP Help.  From the online Table of Contents, choose Scripting Guide.


[Previously JMP Note 46984]


alternative approach (including some other display boxes):
via the Recall Function Library  by @MikeD_Anderson 

Very helpful thanks.

Operating System
macOS Windows
Products JMP JMP Pro