Creating a column switcher - Script JMPHello,
I need some help in order to make a column switcher for a P' chart of Laney for events.
Below is my code:
Firstly, we need to determine a coefficient with these lines:
z_yyy = Eval( {:"Y1"n} );
z_xx = z_yyy[1] << get values;
z_nnn = Eval( {:N} );
z_nn = z_nnn[1] << get values;
z_rrr = Eval( {:Numéro de lot} );
z_Proportion = E Div( z_xx, z_nn );
z_Pbar = V Sum( z_xx ) / V Sum( z_nn );
z_sigma_est = Root( z_Pbar * (1 - z_Pbar) );
z_zvalue = E Mult( ((z_Proportion - z_Pbar) / z_sigma_est), Root( z_nn ) );
z_nr = N Row( z_zvalue );
z_mRList = {0};
z_m = z_zvalue;
z_m[1, 0] = [];
z_m = z_m |/ [0];
z_mr = Abs( z_m - z_zvalue );
z_nr = N Row( z_mr );
z_mr[z_nr, 0] = [];
z_SigmaZ = Mean( z_mr ) / 1.128;
z_KSigmaZ = 3 * z_SigmaZ;Then, here is where I would like to develop a column switcher:
graph = New Window( chart_title,
Control Chart(
Sample Label( :Numéro de lot ),
Sample Size( :N ),
KSigma( z_KSigmaZ ),
Sort by Row Order( 1 ),
Chart Col( :"Y1"n, P( Limits Precision( 1 ), LCL( -3 ) ) ),
SendToReport(
Dispatch(
{},
"P of Y1",
OutlineBox,
{Set Title( "p'-chart, p of Y1" )}
),
Dispatch(
{"P of Y1"},
"2",
ScaleBox,
{Format( "Fixed Dec", 12, 5 ), Min( -0.00025 ), Max( 0.0025 ),
Inc( 0.00025 ), Minor Ticks( 1 )}
),
Dispatch(
{"P of Y1"},
"1",
ScaleBox,
{Min( 0.5 ), Inc( 1 ), Minor Ticks( 0 )}
),
Dispatch(
{"P of Y1"},
"",
AxisBox,
{Add Axis Label( "Taux de défauts pour Y1" )}
),
Dispatch(
{"P of Y1"},
"Proportion pour RNS",
TextEditBox,
{Set Text( "Taux de défauts pour Y1" )}
),
Column Switcher(
:Name( "Y1" ),
{:Name( "Y1" ), :Name( "Y2" ),
:Name( "Y3" ), :Name( "Y4" )}
)
)
);
);
However, this is developed with the Chart Col function and there is no Y to determine, that is why I don't know how to make this colums switcher on it.
Can you please help me with this request?
Thanks a lot,
Regards,
Sébastien
Quality and Process EngineeringRe: Creating a column switcher - Script JMPGreat! It is exactly what I wanted!
Thanks a lot!
Re: Creating a column switcher - Script JMPThe graph reference is again in wrong place. Here is one suggestion how to fix it:
graph_expr = Expr(Graph = Control Chart(
Now you will have graph_expr Expression which when called will create you a control chart which can be referenced with Graph.
You will also have to either call graph_expr before adding column switcher, or move the column switcher inside graph_expr expression. Below is example with the sample data I have been using:
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Quality Control/Coating.jmp");
z_KSigmaZ = 0.1;
graph_expr = Expr(
graph = dt << Control Chart Builder(K Sigma(TBD), Variables(Subgroup(:Sample), Y(:Weight)));
ColumnSwitcherObject = graph << Column Switcher(:Weight, {:Pin, :"Weight 2"n});
);
Substitute Into(graph_expr, Expr(TBD), z_KSigmaZ);
graph_expr; // calling this will create control chart with column switcherRe: Creating a column switcher - Script JMPHere is my script:
Graph=Expr(Control Chart(
Sample Label( :Numéro de lot ),
Sample Size( :Nombre de seringues ),
KSigma(TBD),
Sort by Row Order( 1 ),
Chart Col( :"Y1"n, P( Test Beyond Limits( 1 ), Limits Precision( 1 ), LCL( -3 ) ) ),
SendToReport(
Dispatch(
{},
"P of Y1",
OutlineBox,
{Set Title( "p'-chart, p of Y1" )}
),
Dispatch(
{"P of Y1"},
"2",
ScaleBox,
{Format( "Fixed Dec", 12, 5 ), Min( -0.00025 ), Max( 0.0025 ),
Inc( 0.00025 ), Minor Ticks( 1 )}
),
Dispatch(
{"P of Y1"},
"1",
ScaleBox,
{Min( 0.5 ), Inc( 1 ), Minor Ticks( 0 )}
),
Dispatch(
{"P of Y1"},
"",
AxisBox,
{Add Axis Label( "Taux de défauts pour Y1" )}
),
);
);
);
SubstituteInto(graph, Expr(TBD), z_KSigmaZ);
ColumnSwitcherObject = graph << Column Switcher( :"Y1"n,{:"Y1"n, :"Y2"n});Re: Creating a column switcher - Script JMPWithout knowing how the script looks like, this is the solution I would usually use:
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Quality Control/Coating.jmp");
ksigma = 0.1;
Eval(EvalExpr(nw = New Window("window",
obj = dt << Control Chart Builder(K Sigma(Expr(ksigma)), Variables(Subgroup(:Sample), Y(:Weight)));
)));
Wait(1);
ColumnSwitcherObject = obj << Column Switcher(:Weight, {:Pin, :"Weight 2"n});
Re: Creating a column switcher - Script JMPGreat! It is working!
However, I added in my code the substituteInto because I want to apply a specific Ksigma:
SubstituteInto(graph, Expr(TBD), z_KSigmaZ);
ColumnSwitcherObject = graph << Column Switcher( :Y1,{:Y1, :Y2} );And two windows are created...
Do you know if there is a way to create only one window with the ColumSwitchersObject?
Thanks a lot for your answer
Re: Creating a column switcher - Script JMPTry getting reference to the control chart and not new window. It might help
graph = New Window(chart_title,
cc = Control Chart(
and then try
ColumnSwitcherObject = cc<< Column Switcher( :Y1,{:Y1, :Y2});
Re: Creating a column switcher - Script JMPI tried this at the end of my script:
wait(1);
ColumnSwitcherObject = graph << Column Switcher( :Y1,{:Y1, :Y2});But doesn't work 
Re: Creating a column switcher - Script JMPWith some help from scripting index, maybe something like this would work:
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Quality Control/Coating.jmp");
obj = dt << Control Chart(Sample Size(1), Chart Col(:Weight), Chart Type(Run Chart));
wait(1);
ColumnSwitcherObject = obj << Column Switcher(:Weight, {:Pin, :Sample, :Weight, :"Weight 2"n});