Hello,
I created a script to summarize a data table by analyzing the individual statistical impact of M factors on N metrics.
The summary table show the matrix of N metrics (rows) with M factors (columns), with the specific impact: Mean shift, Cpk degradation, or both)
I want to add a feature to plot the distribution for each selected row with a column formula.
I got inspired by this post:
Linking a cell (in a JMP table) to a script?
The problem is, my script works well in a New Script Window with a fixed selected row ([5] in this example), but then fail when I include the script in the :Graph column formula. I don’t understand why…
Could you please help me debug this?
Attached 2 tables: datatable_test.jmp with the raw data, Summary.jmp with the column formula. The idea is to click on the cell you want to plot in the :Graph column.
Currently the error shows: :”Illegal Reference (recursion) at row [ ]”

When I run the following script with both tables open, it works as expected (see below). But the script fails when run from the table directly (click on cell in Graph column).

Thanks a lot in advance,
-Voiz
// this script works from a Script window
// All features related to the column formula are commented
// here the row selected is row 5 : rn1 = [5]
Names Default To Here( 1 );
dt = Data Table( "datatable_test" );
dt2 = Data Table( "Summary" );
//If( Selected( Row State() ),
Eval(
Parse(
rn1 = [5]/*dt2 << get selected rows*/;
rn = rn1[1];
Factors = dt2 << get column names( "string" );
show(rn1, rn);
Eval(
Eval Expr(
For( i = N Items( Factors ), i >= 1, i--,
CurrCol = Column( dt2, Factors[i] );
If(Char( CurrCol[ rn ] ) == "Ok" | Factors[i] == "Metric"| Factors[i] == "Graph",
Remove From( Factors, i, 1 )
);
)
)
);
FactorA = "X( :" || Char( Factors[1] ) || ", Position( 1 ))";
FactorB = "X(1)";
For( j = 2, j <= N Items( Factors ), j++,
FactorA = Char( FactorA ) || ",X( :" || Char( Factors[j] ) ||
", Position( 1 ))";
FactorB = Char( FactorB ) || ",X( " || Char( j ) || " ) ";
);
Show( dt2:Metric[rn], FactorA, FactorB );
Key = dt2:Metric[rn];
Eval Insert(
" dt << Graph Builder(
Size( 534, 464 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables(
Y( ^Key^ ), ^FactorA^),
Elements( Box Plot( Y, Legend( 18 ), ^FactorB^ ) ),
SendToReport(
Dispatch(
{},
ScaleBox,
{Min( -0.485125992718803 ), Max( 5.53364268893602 ), Inc( 1 ),
Minor Ticks( 0 )}
)
)
) "
);
)
//)
);