For the latest version of JMP Help, visit JMP.com/help.


Scripting Guide > Display Trees > Modal Windows in JSL > Comparison of Column Dialog and New Window
Publication date: 06/21/2023

Comparison of Column Dialog and New Window

Both New Window() and Column Dialog() enable you to construct a launch window that has a column selector. Use Column Dialog() to construct a simple launch window. Several items are added automatically to column dialogs: the Remove and Cancel buttons, the list of columns, and an OK button (if no buttons are explicitly defined).

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dlg = Column Dialog(
	x = ColList( "X", Max Col( 1 ) ),
	y = ColList( "Y", Max Col( 1 ) )
);
 

// returns dlg = {x = {:weight}, y = {:height}, Button(1)};

Show( dlg );
 
If( dlg["Button"] == 1,
	xCol = dlg["x"];
	yCol = dlg["y"];
);
 
Show( xCol, yCol );

xCol = {:height};

yCol = {:weight};

New Window() is more flexible because of numerous optional arguments. In the following example, the user must select two columns before clicking the OK button. A Bivariate graph is then created. Validating the user’s selections is not possible in Column Dialog().

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
xvar = .;
yvar = .;
win = New Window( "Example of Returning Values",
	<<Modal,
 

// require the user to select two variables before clicking OK

	<<On Validate(
		Show( xvar, yvar );
			If( Is Missing( xvar ) | Is Missing( yvar ),
 

// if xvar or yvar are missing do nothing when OK is clicked

			0,
			1
		);
	),
	Text Box( " Select two numeric columns. " ),
	H List Box(
		Text Box( " X, Factor " ),
		x = Col List Box(
			dt, // data table reference
			all, // display all columns from the data table
 

// get the name of the selected column before the window closes

			xvar = (x << Get Selected)[1];
			Show( xvar );
		),
		Text Box( "Y, Response" ),
		y = Col List Box(
			dt,
			all,
			yvar = (y << Get Selected)[1];
			Show( yvar );
		)
	)
);
If (win["Button"] == 1, // if the user clicks OK...
xcol = Column( dt, xvar ); //  get the columns
ycol = Column( dt, yvar );
dt << Bivariate( Y( ycol ), X( xcol ) ); // create a Bivariate plot
);
Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).