<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating a column switcher - Script JMP in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Creating-a-column-switcher-Script-JMP/m-p/477812#M72236</link>
    <description>&lt;P&gt;Great! It is exactly what I wanted!&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
    <pubDate>Mon, 11 Apr 2022 07:18:47 GMT</pubDate>
    <dc:creator>Sebastienlg</dc:creator>
    <dc:date>2022-04-11T07:18:47Z</dc:date>
    <item>
      <title>Creating a column switcher - Script JMP</title>
      <link>https://community.jmp.com/t5/Discussions/Creating-a-column-switcher-Script-JMP/m-p/476074#M72069</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I need some help in order to make a column switcher for a P' chart of Laney for events.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Firstly, we need to determine a coefficient with these lines:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;z_yyy = Eval( {:"Y1"n} );
z_xx = z_yyy[1] &amp;lt;&amp;lt; get values;
z_nnn = Eval( {:N} );
z_nn = z_nnn[1] &amp;lt;&amp;lt; 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;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then, here is where I would like to develop a column switcher:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;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(
&amp;nbsp;:Name( "Y1" ),
&amp;nbsp;{:Name( "Y1" ), :Name( "Y2" ),
&amp;nbsp;:Name( "Y3" ), :Name( "Y4" )}
&amp;nbsp;)
)
);
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, this is developed with the&amp;nbsp;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.&lt;/P&gt;&lt;P&gt;Can you please help me with this request?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot,&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sébastien&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:56:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creating-a-column-switcher-Script-JMP/m-p/476074#M72069</guid>
      <dc:creator>Sebastienlg</dc:creator>
      <dc:date>2023-06-09T16:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a column switcher - Script JMP</title>
      <link>https://community.jmp.com/t5/Discussions/Creating-a-column-switcher-Script-JMP/m-p/476137#M72072</link>
      <description>&lt;P&gt;With some help from scripting index, maybe something like this would work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Quality Control/Coating.jmp");
obj = dt &amp;lt;&amp;lt; Control Chart(Sample Size(1), Chart Col(:Weight), Chart Type(Run Chart));
wait(1);
ColumnSwitcherObject = obj &amp;lt;&amp;lt; Column Switcher(:Weight, {:Pin, :Sample, :Weight, :"Weight 2"n});&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Apr 2022 09:33:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creating-a-column-switcher-Script-JMP/m-p/476137#M72072</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-04-05T09:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a column switcher - Script JMP</title>
      <link>https://community.jmp.com/t5/Discussions/Creating-a-column-switcher-Script-JMP/m-p/476646#M72110</link>
      <description>&lt;P&gt;I tried this at the end of my script:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;	wait(1);
	ColumnSwitcherObject = graph &amp;lt;&amp;lt; Column Switcher( :Y1,{:Y1, :Y2});&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But doesn't work :\&lt;/img&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 11:54:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creating-a-column-switcher-Script-JMP/m-p/476646#M72110</guid>
      <dc:creator>Sebastienlg</dc:creator>
      <dc:date>2022-04-06T11:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a column switcher - Script JMP</title>
      <link>https://community.jmp.com/t5/Discussions/Creating-a-column-switcher-Script-JMP/m-p/476679#M72119</link>
      <description>&lt;P&gt;Try getting reference to the control chart and not new window. It might help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;graph = New Window(chart_title,
	cc = Control Chart(&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and then try&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;ColumnSwitcherObject = cc&amp;lt;&amp;lt; Column Switcher( :Y1,{:Y1, :Y2});&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 14:04:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creating-a-column-switcher-Script-JMP/m-p/476679#M72119</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-04-06T14:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a column switcher - Script JMP</title>
      <link>https://community.jmp.com/t5/Discussions/Creating-a-column-switcher-Script-JMP/m-p/476927#M72137</link>
      <description>&lt;P&gt;Great! It is working!&lt;/P&gt;&lt;P&gt;However, I added in my code the substituteInto because I want to apply a specific Ksigma:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;	SubstituteInto(graph, Expr(TBD), z_KSigmaZ);
	ColumnSwitcherObject = graph &amp;lt;&amp;lt; Column Switcher( :Y1,{:Y1, :Y2} );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And two windows are created...&lt;/P&gt;&lt;P&gt;Do you know if there is a way to create only one window with the ColumSwitchersObject?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot for your answer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 07:50:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creating-a-column-switcher-Script-JMP/m-p/476927#M72137</guid>
      <dc:creator>Sebastienlg</dc:creator>
      <dc:date>2022-04-07T07:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a column switcher - Script JMP</title>
      <link>https://community.jmp.com/t5/Discussions/Creating-a-column-switcher-Script-JMP/m-p/476961#M72143</link>
      <description>&lt;P&gt;Without knowing how the script looks like, this is the solution I would usually use:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Quality Control/Coating.jmp");

ksigma = 0.1;

Eval(EvalExpr(nw = New Window("window",
	obj = dt &amp;lt;&amp;lt; Control Chart Builder(K Sigma(Expr(ksigma)), Variables(Subgroup(:Sample), Y(:Weight)));
)));

Wait(1);
ColumnSwitcherObject = obj &amp;lt;&amp;lt; Column Switcher(:Weight, {:Pin, :"Weight 2"n});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Apr 2022 09:13:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creating-a-column-switcher-Script-JMP/m-p/476961#M72143</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-04-07T09:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a column switcher - Script JMP</title>
      <link>https://community.jmp.com/t5/Discussions/Creating-a-column-switcher-Script-JMP/m-p/477046#M72151</link>
      <description>&lt;P&gt;Here is my script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;	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 &amp;lt;&amp;lt; Column Switcher( :"Y1"n,{:"Y1"n, :"Y2"n});&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Apr 2022 13:24:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creating-a-column-switcher-Script-JMP/m-p/477046#M72151</guid>
      <dc:creator>Sebastienlg</dc:creator>
      <dc:date>2022-04-07T13:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a column switcher - Script JMP</title>
      <link>https://community.jmp.com/t5/Discussions/Creating-a-column-switcher-Script-JMP/m-p/477074#M72152</link>
      <description>&lt;P&gt;The graph reference is again in wrong place. Here is one suggestion how to fix it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;graph_expr = Expr(Graph = Control Chart(&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now you will have &lt;STRONG&gt;graph_expr &lt;/STRONG&gt;Expression which when called will create you a control chart which can be referenced with Graph.&lt;/P&gt;
&lt;P&gt;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:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Quality Control/Coating.jmp");

z_KSigmaZ = 0.1;

graph_expr = Expr(
	graph = dt &amp;lt;&amp;lt; Control Chart Builder(K Sigma(TBD), Variables(Subgroup(:Sample), Y(:Weight)));
	ColumnSwitcherObject = graph &amp;lt;&amp;lt; Column Switcher(:Weight, {:Pin, :"Weight 2"n});
);

Substitute Into(graph_expr, Expr(TBD), z_KSigmaZ);

graph_expr;&amp;nbsp;//&amp;nbsp;calling&amp;nbsp;this&amp;nbsp;will&amp;nbsp;create&amp;nbsp;control&amp;nbsp;chart&amp;nbsp;with&amp;nbsp;column&amp;nbsp;switcher&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Apr 2022 14:57:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creating-a-column-switcher-Script-JMP/m-p/477074#M72152</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-04-07T14:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a column switcher - Script JMP</title>
      <link>https://community.jmp.com/t5/Discussions/Creating-a-column-switcher-Script-JMP/m-p/477812#M72236</link>
      <description>&lt;P&gt;Great! It is exactly what I wanted!&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 07:18:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Creating-a-column-switcher-Script-JMP/m-p/477812#M72236</guid>
      <dc:creator>Sebastienlg</dc:creator>
      <dc:date>2022-04-11T07:18:47Z</dc:date>
    </item>
  </channel>
</rss>

