cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

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

Script for JMP to "display a text box asking for the max, min and target".

Hi,

 

I am trying to create a basic script which analyses my data.

 

When I press the thumbnail linked to the script, I want it to

1. Ask the user to input the ranges

2. Create a data table which shows the max and min

3. Generates a graph with the min, max and the target in it.

 

So far all I can do is get the script for the data table or the graph and incorporate it into shortcuts in JMP separately. I can't figure out how to get it to generate a generate a query box for the user and I can't incorporate the graph and the data table together. Can you advise a basic tutorial set that might help with this?

 

 

Kind regards,

 

Elaina

1 ACCEPTED SOLUTION

Accepted Solutions
ian_jmp
Level X

Re: Script for JMP to "display a text box asking for the max, min and target".

If I have understood correctly, the code below may get you started:

Names Default To Here( 1 );

// Skeleton Table
dt = New Table( "User Supplied Values",
	Add Rows( 0 ),
	New Column( "Minumum", Numeric, "Continuous", ),
	New Column( "Target", Numeric, "Continuous", ),
	New Column( "Maximum", Numeric, "Continuous", )
);
		
// Make a UI to allow the values to be entered
cols = dt << getColumnNames( "String", Continuous );
lub1 = Lineup Box( N Col( 1 ) );
lub2 = Lineup Box( N Col( 1 ) );
For( c = 1, c <= N Items( cols ), c++,
	lub1 << Append( Text Box( cols[c] ) );
	lub2 << Append( Number Edit Box( . ) );
);
nw = New Window( "Enter Values",
	<<onClose( makeGraph ),
	Lineup Box( N Col( 2 ), lub1, lub2 ),
	Lineup Box( N Col( 2 ), Button Box( "Add", addScript ), Button Box( "Cancel", nw << closeWindow ) )
);

// Add a new row to dt when required
addScript = Expr(
	dt << addRows( 1 );
	lastRow = N Row( dt );
	For( c = 1, c <= N Items( cols ), c++,
		Column( dt, c )[lastRow] = (lub2[c] << get);
		lub2[c] << set( . );
		);
	);

// Make a graph
makeGraph = Expr(
	If( N Row( dt ) > 0, 
			Beep();
			Print("Insert code here.")	
		);
	);

 

View solution in original post

1 REPLY 1
ian_jmp
Level X

Re: Script for JMP to "display a text box asking for the max, min and target".

If I have understood correctly, the code below may get you started:

Names Default To Here( 1 );

// Skeleton Table
dt = New Table( "User Supplied Values",
	Add Rows( 0 ),
	New Column( "Minumum", Numeric, "Continuous", ),
	New Column( "Target", Numeric, "Continuous", ),
	New Column( "Maximum", Numeric, "Continuous", )
);
		
// Make a UI to allow the values to be entered
cols = dt << getColumnNames( "String", Continuous );
lub1 = Lineup Box( N Col( 1 ) );
lub2 = Lineup Box( N Col( 1 ) );
For( c = 1, c <= N Items( cols ), c++,
	lub1 << Append( Text Box( cols[c] ) );
	lub2 << Append( Number Edit Box( . ) );
);
nw = New Window( "Enter Values",
	<<onClose( makeGraph ),
	Lineup Box( N Col( 2 ), lub1, lub2 ),
	Lineup Box( N Col( 2 ), Button Box( "Add", addScript ), Button Box( "Cancel", nw << closeWindow ) )
);

// Add a new row to dt when required
addScript = Expr(
	dt << addRows( 1 );
	lastRow = N Row( dt );
	For( c = 1, c <= N Items( cols ), c++,
		Column( dt, c )[lastRow] = (lub2[c] << get);
		lub2[c] << set( . );
		);
	);

// Make a graph
makeGraph = Expr(
	If( N Row( dt ) > 0, 
			Beep();
			Print("Insert code here.")	
		);
	);

 

Recommended Articles