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
uday_guntupalli
Level VIII

Save Analysis to Table Using Variable (in JSL)

All, 

    Trying to figure out how to save an analyses to a data table using a variable . I tried multiple options : 

1. Option 1 : Adding Col List to table as a variable 

 

 

dt = Open("$SAMPLE_DATA/Big Class.jmp");
myvar = dt << Get column Names("String");
dt << Set Table Variable("ColNames", myvar);
dt << New Script("Save Analyses Using Variable",
Bivariate(myvar[2],myvar[4],Fit Line)
);



2. Using the column name from a list 

BivAfter = Bivariate(
                           Y( Eval(TempCols[r])), // 
                           X( :age ),
                          Automatic Recalc( 1 ),
                           Fit Line( {Line Color( {213, 72, 87} )} )
                           );



Option 2 works when you are running the script and saves the analyses to the data table . But if I close the script and try to launch the analyses from the table - it fails . 
Can anybody help please ? 
Best 
Uday 


 

Best
Uday
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Save Analysis to Table Using Variable (in JSL)

You need to evaluate your column references before adding a new table script. See example below.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
myvar = dt << Get column Names();

Eval(
	Eval Expr(
		dt << New Script(
			"Save Analyses Using Variable",
			Names Default To Here( 1 );
			dt = current data table();
			biv = dt << Bivariate( Y( Expr( myvar[2] ) ), X( Expr( myvar[4] ) ), Fit Line );
		)
	)
);
Justin

View solution in original post

1 REPLY 1

Re: Save Analysis to Table Using Variable (in JSL)

You need to evaluate your column references before adding a new table script. See example below.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
myvar = dt << Get column Names();

Eval(
	Eval Expr(
		dt << New Script(
			"Save Analyses Using Variable",
			Names Default To Here( 1 );
			dt = current data table();
			biv = dt << Bivariate( Y( Expr( myvar[2] ) ), X( Expr( myvar[4] ) ), Fit Line );
		)
	)
);
Justin