cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
midori555
Level II

save New Window scripts into data table

I have a lengthy new window script generated by Fit Y by X. It looks like:

 

New Window( "y vs x",
V List Box(
Fit Group(
Bivariate(
Y( :yy ),
X( :xx ),
.......

 

 

I tried to save the new window script in the data table using:

 

win = New Window( "y vs x",
V List Box(
Fit Group(
Bivariate(
Y( :yy ),
X( :xx ),
.......

dt << New Table Script( "y vs x", win<<get script() );

 

But that didn't work.

Instead of copying the whole script into the jsl_expression in the New Table Script I'm looking for something that's more concise.

Thanks for any help! 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: save New Window scripts into data table

While @cwillden code will save the script for the New Window(), the unfortunate item is that there are issues with the script created in JMP from a New Window().

I have been more successful in creating in the JSL, an expression of  the script I am going to create, and then running the script from the expression, and then secondly, converting the literal string and saving it as a script to the data table.

Names Default To Here( 1 );
dt = Current Data Table();

x = Expr(
	win = New Window( "y vs x",
		V List Box(
			Fit Group( Bivariate( Y( :height ), X( :weight ) ) )
		)
	)
);
Eval( x );
Eval(
	Substitute(
			Expr(
				dt << New Script( "y vs x", __x__ )
			),
		Expr( __x__ ), Eval Expr( x )
	)
);

 

Jim

View solution in original post

4 REPLIES 4
cwillden
Super User (Alumni)

Re: save New Window scripts into data table

The problem is the table will literally contain the script "win << get script()" so that script will no longer work once that window named "win" has been closed.  Try this:

Eval(
	Parse(
		Eval Insert( "\[dt << New Table Script("y vs. x", ^win << get script^)]\" )
	)
);
-- Cameron Willden
txnelson
Super User

Re: save New Window scripts into data table

While @cwillden code will save the script for the New Window(), the unfortunate item is that there are issues with the script created in JMP from a New Window().

I have been more successful in creating in the JSL, an expression of  the script I am going to create, and then running the script from the expression, and then secondly, converting the literal string and saving it as a script to the data table.

Names Default To Here( 1 );
dt = Current Data Table();

x = Expr(
	win = New Window( "y vs x",
		V List Box(
			Fit Group( Bivariate( Y( :height ), X( :weight ) ) )
		)
	)
);
Eval( x );
Eval(
	Substitute(
			Expr(
				dt << New Script( "y vs x", __x__ )
			),
		Expr( __x__ ), Eval Expr( x )
	)
);

 

Jim
midori555
Level II

Re: save New Window scripts into data table

Thanks Jim. It works!
SpannerHead
Level III

Re: save New Window scripts into data table

Am I able to apply this to a plot window I already made?  If I just want to extract the script for the plots from another script without manually doing it is that possible?  I've seen examples where this can be done with graph builder but I can't seem to apply that to a series of X-Y plots.