Subscribe Bookmark RSS Feed

Save Analysis to Table Using Variable (in JSL)

uday_guntupalli

Community Trekker

Joined:

Sep 15, 2014

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
Justin_Chilton

Joined:

Aug 27, 2015

Solution

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
1 REPLY
Justin_Chilton

Joined:

Aug 27, 2015

Solution

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