My script was intended to give you a pointer towards possible methods that could be used, with the hope that it would provide sufficient insight. I hope I can improve on my input with the following:
I did not mention 2 methods in my previous response. I mentioned 3 methods, Filter Change Handler, RowState Handler and Add Graphics Script. Given the particulars of what you need, you may choose to use any one of the different options. I have provided 2 scripts below, one using the RowState Handler, and the other using the Add Graphics Script.
The RowState Handler is very similar to the implementation of the Filter Change Handler. Using it, the changes are triggered if any changes are made to the RowState column in the data table.
names default to here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dist = Distribution(
Automatic Recalc( 1 ),
Continuous Distribution(
Quantiles( 0 ),
Summary Statistics( 1 ),
Column( :weight ),
Horizontal Layout( 1 ),
Ppk Capability Labeling( 1 ),
Capability Analysis( LSL( 80 ), USL( 140 ) )
)
);
addit = Function({},
PpkValue = (dist << report)["Long Term Sigma"][Number Col Box( 1 )][2];
PPKtb = Table Box( String Col Box( "Parameter", {"Ppk"} ), Number Col Box( "Value", {PpkValue} ) );
(dist << report)["Summary Statistics"] << Append( PPKtb );
(dist << report)["Long Term Sigma"] << delete;);
f = Function( {a}, addit() );
rs = dt << Make RowState Handler( f );
addit();
The Add Graphics example iis more complex. This is primarily, because the script writer has to determine what items need to be compared to then trigger the code to be run. In the below case, the checking to see if the mean or standard deviation changes, triggers the running of the code. That may not be sufficient, for the kinds of things your users might be changing...so that made need to be expanded or completly changed.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dist = Distribution(
Automatic Recalc( 1 ),
Continuous Distribution(
Quantiles( 0 ),
Summary Statistics( 1 ),
Column( :weight ),
Horizontal Layout( 1 ),
Ppk Capability Labeling( 1 ),
Capability Analysis( LSL( 80 ), USL( 140 ) )
)
);
addit = Function( {},
PpkValue = (dist << report)["Long Term Sigma"][Number Col Box( 1 )][2];
PPKtb = Table Box( String Col Box( "Parameter", {"Ppk"} ), Number Col Box( "Value", {PpkValue} ) );
(dist << report)["Summary Statistics"] << Append( PPKtb );
(dist << report)["Long Term Sigma"] << delete;
);
theMean = ((dist << report)["Summary Statistics"][Number Col Box( 1 )] << get)[1];
theSTD = ((dist << report)["Summary Statistics"][Number Col Box( 1 )] << get)[2];
(dist << report)[framebox( 2 )] << add graphics script(
If(
theMean != ((dist << report)["Summary Statistics"][Number Col Box( 1 )] << get)[1] | theSTD != ((dist
<< report)["Summary Statistics"][Number Col Box( 1 )] << get)[2],
addit()
);
theMean = ((dist << report)["Summary Statistics"][Number Col Box( 1 )] << get)[1];
theSTD = ((dist << report)["Summary Statistics"][Number Col Box( 1 )] << get)[2];
);
addit();
I strongly suggest that you take the time to read the Scripting Guide, and to familiarize yourself with the Scripting Index. The overview of JSL in the Scripting Guide provides the foundation one needs to be a proficient JSL programmer, and the examples for all of the objects and functions in the Scripting Index are invaluable in writing the code