Hi @swiergi11 ,
I think one of the problems is how you reference the column in the Chart Col() part of the Control Chart(). The problem is that it's not evaluating the :"RSM_"||level as a column, just the :"RSM_" part and so it doesn't know what to do with the ||layer concatenation.
As a workaround, you can evaluate the concatenation before you call the Control Chart with something like: Ycol="RSM_"||layer; then, instead of :"RSM_"||layer as the Chart Col(), use: Cart Col( As Column(Ycol) ), and you'll be able to run the script as you expect.
Here's the modified code below:
Names Default To Here( 1 );
New Window( "Data selection",
<<Modal,
Panel Box( "Select a Date Range",
Lineup Box( N Col( 1 ),
text box("Chart ID"),
rr_cb = Combo Box( {"D0585DI", "D0585IG","D0585L3","D0585L2", "D0585L1"}, <<Set Width( 5 ) ))),
H List Box(
Button Box( "OK",
<<Set Function(
Function( {self},
layer = rr_cb << GetText;
)
)
),
Button Box( "Cancel" )
)
);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
//changing the "weight"" column name to RSM_"whichever chosen argument from combo box"
:weight << Set Name("RSM_"||layer);
//Creat control chart using RSM_"whichever choosen argument from combo box"
Ycol="RSM_"||layer;
dt <<
Control Chart(
Sample Label( :name),
Chart Col(
As Column(Ycol),
Levey Jennings(
Show Zones( 1 ),Shade Zones( 1 ),
Test 1( 1 ),
Test 2( 1 ),
Test 5( 1 ),
Test 6( 1 ),
Test Beyond Limits( 1 )
),
Capability(
Distribution(
Continuous Distribution(
Column(:"RSM_"||layer),
Quantiles( 0 ),
Horizontal Layout( 1 ),
Vertical( 0 ),
Outlier Box Plot( 0 ),
Normal Quantile Plot( 1 ),
//Fit Distribution( "All" ),
Process Capability(
Use Column Property Specs,
Process Capability Analysis(
Process Summary( 1 ),
Nonconformance( 0 ),
Within Sigma Capability( 1 ),
Histogram( 1, Show Within Sigma Density( 1 ) )
)
),
Customize Summary Statistics( Skewness( 1 ) ),
)
)
)
));
Hope this helps!,
DS