JSL - Why do I get error first time running script, but second time onward works?
The first time running the script shown below returns this error "Name Unresolved: m{36803} in access or evaluation of 'm', m/*###*/", while every subsequent run does not return that error. Why is this?
DataCV=open("C:\Desktop\JMP\sample_CV_data.csv");
Summarize( DataCV, processArray = By( :process ) );
Summarize( DataCV, ctypeArray = By( :c_type ) );
For( n = 1, n <= Length( ctypeArray ), n++, // Generates and saves all splines by :c_type and :process
For( m = 1, m <= Length( processArray ), m++,
Eval(
Substitute(
Expr(
biv = Bivariate(
Y( :c_mm_deembed_pf ),
X( :v_dut_volt ),
Where( :c_type == __ctype__ & :process == __process__ ),
Fit Spline( 0.1, standardized, {save predicteds} )
)
),
Expr( __process__ ), processArray[m],
Expr( __ctype__ ), ctypeArray[n],
)
)
);
);
(Data Table( DataCV ) << Tabulate( // Create new table
Add Table(
Column Table( Analysis Columns( :Spline Predictor for c_mm_deembed_pf Where ) ),
Row Table( Grouping Columns(:serial_num, :process, :c_type, :v_dut_volt ) )
)
)) << Make Into Data Table;
currentDataTable()<<ADDROWS></ADDROWS>
Re: JSL - Why do I get error first time running script, but second time onward works?Have you tried throwing in a
Names default to here(1);
at the beginning of your script.
Your variable m might be defined by another script and it could be interfering here untill it is overwritten for the first time by this script.
Re: JSL - Why do I get error first time running script, but second time onward works?@adjo9835 Did you find the problem? I am getting this error too with a variable, only on the first run but not the second. I am using JMP 15
Re: JSL - Why do I get error first time running script, but second time onward works?Thanks! I feel pretty good about it considering this is my first time using JMP and that file conversion isnt a typical JMP application.
Im still getting the same error, only on the first time running the script, shown below.
The script even generates and saves one of the splines from one of the :c_type x :process Where-clause combinations, into a new column, before throwing the error. Implying that it went through one full iteration of the for loop shown below:
For( n = 1, n <= Length( ctypeArray ), n++,
The 1 spline that was created and saved into a new column is shown below:
I am going to try and update to JMP 14, to see if that solves the problem. I have been using JMP 13.0.0
Re: JSL - Why do I get error first time running script, but second time onward works?Pretty cool script!
Try this version
DataCV = Open( "$sample_data/big class.jmp" );
Summarize( DataCV, processArray = By( :age ) );
Summarize( DataCV, ctypeArray = By( :sex ) );
For( n = 1, n <= Length( ctypeArray ), n++,
Show( n, ctypeArray[n] );
For( m = 1, m <= Length( processArray ), m++,
Show( m, processArray[m] );
temp = Substitute(
Expr(
biv = Bivariate(
Y( :height ),
X( :weight ),
Where( :sex == __ctype__ & :age == Num( __process__ ) ),
Fit Spline( 0.1, standardized, {save predicteds} )
)
),
Expr( __process__ ), processArray[m],
Expr( __ctype__ ), ctypeArray[n],
);
Show( Name Expr( temp ) );
Eval( temp );
);
);
Other than the change to a sample script and adding the NUM() wrapper and printing the intermediate expression, I don't think I've changed anything. In JMP 14, I don't see the error you describe.
It looks like the summary of the numeric age column made a list of strings rather than numbers, so num converts it back. I don't think this is part of the original problem you described.
@EvanMcCorkle
Re: JSL - Why do I get error first time running script, but second time onward works?Adding:
show(m,processArray[m]);
to the script results in the log showing:
m = 1;
processArray[m] = "DVT0002B";
therefore, the error must be inside of the Eval()?
The data table has no columns named "m".
Re: JSL - Why do I get error first time running script, but second time onward works?Try something like this for a start. Is the error in that Eval? Does the table have a column named "m"?
For( m = 1, m <= Length( processArray ), m++,
show(m,processArray[m]); // <<<<<<
Eval( ...
You can further isolate what's happening with an intermediate variable to hold (and print the nameexpr) the result of substitute.