<?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: JMP Script: Column switcher applied on a coefficient in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/478901#M72316</link>
    <description>&lt;P&gt;Sorry, this may not be very helpful. I had errors in the control chart code because the dataset isn't really suitable for a control chart and I didn't have time to debug with a proper data set. But you might be able to use this and debug the control chart code.&amp;nbsp; I just tested it with the distribution platform instead of control chart and it worked ok.&amp;nbsp; Keep in mind the col list box with the "on change()" code takes the place of the column switcher, so you don't need to add that to the control chart code. It just gets deleted and re-run every time you select a new parameter (column) from the col list box.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I didn't realize you also wanted plots. In that case a column switcher may have been more appropriate to use. There are ways to intercept that the selection has changed and you can run code to update your variables and re-plot. But this col list box() approach should also work ok.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt = open("$SAMPLE_DATA\Big Class.jmp");



// New columns, update big class for y1, y2, y3
Local( {dt},
	dt = Data Table( "Big Class" );
	dt &amp;lt;&amp;lt; New Column( "Y1",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected
	) &amp;lt;&amp;lt; New Column( "Y2",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected
	) &amp;lt;&amp;lt; New Column( "Y3",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected
	) &amp;lt;&amp;lt; Begin Data Update;
	For Each Row(
		dt,
		:Y1 = Random Integer( 1, 40 );
		:Y2 = Random Integer( 1, 40 );
		:Y3 = Random Integer( 1, 40 );
	);
	dt &amp;lt;&amp;lt; End Data Update;
);

colList = {"Y1", "Y2", "Y3"};



new window("Calculations",
	hlb = hlistbox(
		clb = col list box(dt, max selected(1),
			on change(
				try(calcVlb &amp;lt;&amp;lt; delete());
				currCol = clb &amp;lt;&amp;lt; get selected();
				currColName = char(currCol[1]);
				
				z_yyy = Eval(column(currCol));// Eval( {currCol} );
				z_xx = z_yyy &amp;lt;&amp;lt; get values;
				z_nnn = Eval( {:weight} );  //change back
				z_nn = z_nnn[1] &amp;lt;&amp;lt; get values;
				z_rrr = Eval( {:age} );    //change back

				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;

				show(currCol[1]);
				show(z_Proportion);

				hlb &amp;lt;&amp;lt; append(
					calcVlb = vlistbox(
						textbox("Variables updated to column " || currCol[1]);
					)
				);
				
				calcVlb &amp;lt;&amp;lt; append(
					Distribution(
						Stack( 1 ),
						Continuous Distribution(
							Column( column(currCol[1])),
							Horizontal Layout( 1 ),
							Vertical( 0 ),
							PpK Capability Labeling( 0 ),
							Customize Summary Statistics(
								Std Err Mean( 0 ),
								Upper Mean Confidence Interval( 0 ),
								Lower Mean Confidence Interval( 0 ),
								N Missing( 1 ),
								Range( 1 )
							)
						)
					);
				);
		//Graph_exprall=Expr(
/*
				hlb &amp;lt;&amp;lt; append(
				Graphall = Control Chart(
						Sample Label( :weight ),
						Sample Size( :age ),
						KSigma(z_KSigmaZ),
						Sort by Row Order( 1 ),
					Chart Col( column(currCol[1]), P( Test Beyond Limits( 1 ), Limits Precision( 1 ), LCL( -3 ) ) ),
				SendToReport(
				Dispatch(
					{},
					"P of Y1",
					OutlineBox,
					{Set Title( "p'-chart, Proportion de défaut" )}
				),
				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 (srg)" )}
				)));
				//ColumnSwitcherObject = graphall &amp;lt;&amp;lt; Column Switcher( :"Y1"n,{:"Y2"n, :"Y3"n, :"Y4"n, :"Y5"n ,"Y6"n ,"Y7"n});	
		//		);

				// On affecte le SigmaZ à la carte de controle
		//		SubstituteInto(Graph_exprall, Expr(TBD), z_KSigmaZ);
		//		Graph_exprall;				
				);
				*/
			)
		)
	)
);



clb &amp;lt;&amp;lt; append(colList);
clb &amp;lt;&amp;lt; set selected(1);


&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 13 Apr 2022 14:48:45 GMT</pubDate>
    <dc:creator>mikedriscoll</dc:creator>
    <dc:date>2022-04-13T14:48:45Z</dc:date>
    <item>
      <title>JMP Script: Column switcher applied on a coefficient</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/478534#M72275</link>
      <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to make a column switcher on different calcul made by this script:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;		//Calcul du Zsigma
z_yyy = Eval( {&lt;STRONG&gt;:"Y1"n&lt;/STRONG&gt;} );
z_xx = z_yyy[1] &amp;lt;&amp;lt; get values;
z_nnn = Eval( {:Nombre de seringues} );
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;And then, here is the column switcher:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Column = z_yyy &amp;lt;&amp;lt; Column Switcher( :"Y1"n,{:"Y1"n, :"Y2"n, :"Y3"n, :"Y4"n ,"Y5"n ,"Y6"n});&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, I get a message error because the column switcher is not applied on an object...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have any suggestion for helping me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Sebastien&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:56:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/478534#M72275</guid>
      <dc:creator>Sebastienlg</dc:creator>
      <dc:date>2023-06-09T16:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Script: Column switcher applied on a coefficient</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/478598#M72280</link>
      <description>&lt;P&gt;The Column Switcher feature is part of a JMP platform like Graph Builder or Bivariate. It is not a feature of a matrix. It does not create a data column in a data table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to create a data table with the matrix, launch a platform by assigning data columns to analysis roles, and then enable the column switcher feature.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 13:37:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/478598#M72280</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2022-04-12T13:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Script: Column switcher applied on a coefficient</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/478714#M72295</link>
      <description>&lt;P&gt;Hi Sebastien,&amp;nbsp;&lt;/P&gt;&lt;P&gt;It sounds like you want JMP to update those calculations (variables) when you click on a list of columns. Is that correct? If so, the code below uses a col list box to accomplish this.&amp;nbsp; The first bit is just setting up a sample table to have Y1, Y2 and Y3 columns.&amp;nbsp; Then build a new window with a col list box and populate it with the list of columns. Have it so that it has a max number of columns selectable == 1. When the selection changes it will recalculate.&amp;nbsp; There's a v list box() called calcVlb that you can append graphics to. When you change to the next selection it will delete the old one before replacing with the new one. Right now, it only appends a text box as an example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt = open("$SAMPLE_DATA\Big Class.jmp");



// New columns, update big class for y1, y2, y3
Local( {dt},
	dt = Data Table( "Big Class" );
	dt &amp;lt;&amp;lt; New Column( "Y1",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected
	) &amp;lt;&amp;lt; New Column( "Y2",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected
	) &amp;lt;&amp;lt; New Column( "Y3",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected
	) &amp;lt;&amp;lt; Begin Data Update;
	For Each Row(
		dt,
		:Y1 = Random Integer( 1, 40 );
		:Y2 = Random Integer( 1, 40 );
		:Y3 = Random Integer( 1, 40 );
	);
	dt &amp;lt;&amp;lt; End Data Update;
);

colList = {"Y1", "Y2", "Y3"};



new window("Calculations",
	hlb = hlistbox(
		clb = col list box(dt, max selected(1),
			on change(
				try(calcVlb &amp;lt;&amp;lt; delete());
				currCol = clb &amp;lt;&amp;lt; get selected();
				currColName = char(currCol[1]);
				
				z_yyy = Eval(column(currCol));// Eval( {currCol} );
				z_xx = z_yyy &amp;lt;&amp;lt; get values;
				z_nnn = Eval( {:weight} );  //change back
				z_nn = z_nnn[1] &amp;lt;&amp;lt; get values;
				z_rrr = Eval( {:age} );    //change back

				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;

				show(currCol[1]);
				show(z_Proportion);

				hlb &amp;lt;&amp;lt; append(
					calcVlb = vlistbox(
						textbox("Variables updated to column " || currCol[1]);
					)
				)
			)
		)
	)
);



clb &amp;lt;&amp;lt; append(colList);
clb &amp;lt;&amp;lt; set selected(1);


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Apr 2022 20:57:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/478714#M72295</guid>
      <dc:creator>mikedriscoll</dc:creator>
      <dc:date>2022-04-12T20:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Script: Column switcher applied on a coefficient</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/478810#M72304</link>
      <description>&lt;P&gt;Great! It is working on my script!&lt;/P&gt;&lt;P&gt;But then, I got a new problem :\&lt;/img&gt;&lt;/P&gt;&lt;P&gt;The graph I made is not updated with the coefficient calculated...&lt;/P&gt;&lt;P&gt;Here is my example again:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;colList = {"Y1", "Y2", "Y3"};
		new window("Calculations",
		hlb = hlistbox(
			clb = col list box(dt, max selected(1),
				on change(
					try(calcVlb &amp;lt;&amp;lt; delete());
					currCol = clb &amp;lt;&amp;lt; get selected();
					currColName = char(currCol[1]);
					
					z_yyy = Eval(column(currCol));// Eval( {currCol} );
					z_xx = z_yyy &amp;lt;&amp;lt; get values;
					z_nnn = Eval( {:Nombre de seringues} );
					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;

					show(currCol[1]);
					show(z_Proportion);
					show(z_KSigmaZ);
					
					hlb &amp;lt;&amp;lt; append(
						calcVlb = vlistbox(
							textbox("Variables updated to column " || currCol[1]);
						)
					)
				)
			)
		)
	);
// Creation des cartes
	clb &amp;lt;&amp;lt; append(colList);
	clb &amp;lt;&amp;lt; set selected(1);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The z_KSigmaZ is updated as I wanted for each variable.&lt;/P&gt;&lt;P&gt;But then, I would like to create this graph:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;	Graph_exprall=Expr(
		Graphall = 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, Proportion de défaut" )}
		),
		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 (srg)" )}
		)));
		ColumnSwitcherObject = graphall &amp;lt;&amp;lt; Column Switcher( :"Y1"n,{:"Y2"n, :"Y3"n, :"Y4"n, :"Y5"n ,"Y6"n ,"Y7"n});	
		);

		// On affecte le SigmaZ à la carte de controle
		SubstituteInto(Graph_exprall, Expr(TBD), z_KSigmaZ);
		Graph_exprall;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is there a way to update the graph with the new z_KSigmaZ coefficient calculated?&lt;/P&gt;&lt;P&gt;I think it would better to set up the&amp;nbsp;z_KSigmaZ coefficient and the variable selection within the control chart window.&lt;/P&gt;&lt;P&gt;Can you help me with that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 09:43:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/478810#M72304</guid>
      <dc:creator>Sebastienlg</dc:creator>
      <dc:date>2022-04-13T09:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Script: Column switcher applied on a coefficient</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/478901#M72316</link>
      <description>&lt;P&gt;Sorry, this may not be very helpful. I had errors in the control chart code because the dataset isn't really suitable for a control chart and I didn't have time to debug with a proper data set. But you might be able to use this and debug the control chart code.&amp;nbsp; I just tested it with the distribution platform instead of control chart and it worked ok.&amp;nbsp; Keep in mind the col list box with the "on change()" code takes the place of the column switcher, so you don't need to add that to the control chart code. It just gets deleted and re-run every time you select a new parameter (column) from the col list box.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I didn't realize you also wanted plots. In that case a column switcher may have been more appropriate to use. There are ways to intercept that the selection has changed and you can run code to update your variables and re-plot. But this col list box() approach should also work ok.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt = open("$SAMPLE_DATA\Big Class.jmp");



// New columns, update big class for y1, y2, y3
Local( {dt},
	dt = Data Table( "Big Class" );
	dt &amp;lt;&amp;lt; New Column( "Y1",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected
	) &amp;lt;&amp;lt; New Column( "Y2",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected
	) &amp;lt;&amp;lt; New Column( "Y3",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected
	) &amp;lt;&amp;lt; Begin Data Update;
	For Each Row(
		dt,
		:Y1 = Random Integer( 1, 40 );
		:Y2 = Random Integer( 1, 40 );
		:Y3 = Random Integer( 1, 40 );
	);
	dt &amp;lt;&amp;lt; End Data Update;
);

colList = {"Y1", "Y2", "Y3"};



new window("Calculations",
	hlb = hlistbox(
		clb = col list box(dt, max selected(1),
			on change(
				try(calcVlb &amp;lt;&amp;lt; delete());
				currCol = clb &amp;lt;&amp;lt; get selected();
				currColName = char(currCol[1]);
				
				z_yyy = Eval(column(currCol));// Eval( {currCol} );
				z_xx = z_yyy &amp;lt;&amp;lt; get values;
				z_nnn = Eval( {:weight} );  //change back
				z_nn = z_nnn[1] &amp;lt;&amp;lt; get values;
				z_rrr = Eval( {:age} );    //change back

				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;

				show(currCol[1]);
				show(z_Proportion);

				hlb &amp;lt;&amp;lt; append(
					calcVlb = vlistbox(
						textbox("Variables updated to column " || currCol[1]);
					)
				);
				
				calcVlb &amp;lt;&amp;lt; append(
					Distribution(
						Stack( 1 ),
						Continuous Distribution(
							Column( column(currCol[1])),
							Horizontal Layout( 1 ),
							Vertical( 0 ),
							PpK Capability Labeling( 0 ),
							Customize Summary Statistics(
								Std Err Mean( 0 ),
								Upper Mean Confidence Interval( 0 ),
								Lower Mean Confidence Interval( 0 ),
								N Missing( 1 ),
								Range( 1 )
							)
						)
					);
				);
		//Graph_exprall=Expr(
/*
				hlb &amp;lt;&amp;lt; append(
				Graphall = Control Chart(
						Sample Label( :weight ),
						Sample Size( :age ),
						KSigma(z_KSigmaZ),
						Sort by Row Order( 1 ),
					Chart Col( column(currCol[1]), P( Test Beyond Limits( 1 ), Limits Precision( 1 ), LCL( -3 ) ) ),
				SendToReport(
				Dispatch(
					{},
					"P of Y1",
					OutlineBox,
					{Set Title( "p'-chart, Proportion de défaut" )}
				),
				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 (srg)" )}
				)));
				//ColumnSwitcherObject = graphall &amp;lt;&amp;lt; Column Switcher( :"Y1"n,{:"Y2"n, :"Y3"n, :"Y4"n, :"Y5"n ,"Y6"n ,"Y7"n});	
		//		);

				// On affecte le SigmaZ à la carte de controle
		//		SubstituteInto(Graph_exprall, Expr(TBD), z_KSigmaZ);
		//		Graph_exprall;				
				);
				*/
			)
		)
	)
);



clb &amp;lt;&amp;lt; append(colList);
clb &amp;lt;&amp;lt; set selected(1);


&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Apr 2022 14:48:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/478901#M72316</guid>
      <dc:creator>mikedriscoll</dc:creator>
      <dc:date>2022-04-13T14:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Script: Column switcher applied on a coefficient</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/479085#M72334</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for your answer, it helps me a lot.&lt;/P&gt;&lt;P&gt;And I think I am almost there.&lt;/P&gt;&lt;P&gt;There is only one thing that doesn't work, the z_KSigmaZ is not updated on the graph made...&lt;/P&gt;&lt;P&gt;Here is my code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;colList = {"Y1", "Y2", "Y3"};

new window("Calculations",
	hlb = hlistbox(
		clb = col list box(dt, max selected(1),
			on change(
				try(calcVlb &amp;lt;&amp;lt; delete());
				currCol = clb &amp;lt;&amp;lt; get selected();
				currColName = char(currCol[1]);
				
				z_yyy = Eval(column(currCol));// Eval( {currCol} );
				z_xx = z_yyy &amp;lt;&amp;lt; get values;
				z_nnn = Eval( {:Nombre de seringues} );  //change back
				z_nn = z_nnn[1] &amp;lt;&amp;lt; get values;
				z_rrr = Eval( {:Numéro de lot} );    //change back

				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;

				show(currCol[1]);
				show(z_Proportion);

				hlb &amp;lt;&amp;lt; append(
					calcVlb = vlistbox(
						textbox("Variables updated to column " || currCol[1]);
					)
				);
				
				/*calcVlb &amp;lt;&amp;lt; append(
					Distribution(
						Stack( 1 ),
						Continuous Distribution(
							Column( column(currCol[1])),
							Horizontal Layout( 1 ),
							Vertical( 0 ),
							PpK Capability Labeling( 0 ),
							Customize Summary Statistics(
								Std Err Mean( 0 ),
								Upper Mean Confidence Interval( 0 ),
								Lower Mean Confidence Interval( 0 ),
								N Missing( 1 ),
								Range( 1 )
							)
						)
					);
				);*/
		
Graph_exprall=Expr(
				hlb &amp;lt;&amp;lt; append(
				
				Graphall = Control Chart(
						Sample Label( :Numéro de lot ),
						Sample Size( :Nombre de seringues ),
						KSigma(z_KSigmaZ),
						Sort by Row Order( 1 ),
					Chart Col( column(currCol[1]), P( Test Beyond Limits( 1 ), Limits Precision( 1 )) ),
				SendToReport(
				Dispatch(
					{},
					"P of Y1",
					OutlineBox,
					{Set Title( "p'-chart, Proportion de défaut" )}
				),
				Dispatch(
					{"P of Y1"},
					"2",
					ScaleBox,
					{Format( "Fixed Dec", 12, 5 ),	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 (srg)" )}
				)));
				ColumnSwitcherObject = graphall &amp;lt;&amp;lt; Column Switcher( :"Y1"n,{:"Y1"n, :"Y2"n, :"Y3"n});	
				
				);

							
				);
			
			)
		)
	)
);

clb &amp;lt;&amp;lt; append(colList);
clb &amp;lt;&amp;lt; set selected(1);

SubstituteInto(Graph_exprall, Expr(TBD), z_KSigmaZ);
Graph_exprall;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The z_KSigmaZ is well calculated, however, it is not applied on the graph made...&lt;/P&gt;&lt;P&gt;I think it comes from the&amp;nbsp;&lt;CODE class=" language-jsl"&gt;SubstituteInto(Graph_exprall, Expr(TBD), z_KSigmaZ);&lt;/CODE&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you help me with that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2022 09:39:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/479085#M72334</guid>
      <dc:creator>Sebastienlg</dc:creator>
      <dc:date>2022-04-14T09:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Script: Column switcher applied on a coefficient</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/479134#M72343</link>
      <description>&lt;P&gt;I'm not sure because I don't have a dataset set up to debug it, but I changed your code in the expression and removed the TBD and replaced it with the variable itself. You can try changing it back to TBD.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="language-jsl"&gt;&lt;CODE&gt;						KSigma(z_KSigmaZ),&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Apr 2022 14:27:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/479134#M72343</guid>
      <dc:creator>mikedriscoll</dc:creator>
      <dc:date>2022-04-14T14:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Script: Column switcher applied on a coefficient</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/480525#M72498</link>
      <description>&lt;P&gt;I tried with this expression:&lt;/P&gt;&lt;P&gt;KSigma(TBD),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but the KSigma is not updated on the graph with the colList selected.&lt;/P&gt;&lt;P&gt;However the graph is updated with the column (switcher) selected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea to help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You will find attached a dataset exemple.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 06:52:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/480525#M72498</guid>
      <dc:creator>Sebastienlg</dc:creator>
      <dc:date>2022-04-20T06:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Script: Column switcher applied on a coefficient</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/480726#M72518</link>
      <description>&lt;P&gt;You can try this out and see if it works for you.&amp;nbsp; It seemed to work ok for me. I got some warnings in the log about the z_xx assigment, but it did actually get assigned just fine. In my example below i made a new column where Y3 = Y2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Log warning:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Send Expects Scriptable Object in access or evaluation of 'Send' , z_yyy &amp;lt;&amp;lt; /*###*/get values/*###*/&lt;/P&gt;&lt;P&gt;at line 16&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
dt = current data table();

colList = {"Y1", "Y2", "Y3"};


new window("Calculations",
	hlb = hlistbox(
		clb = col list box(dt, max selected(1),
			on change(
				try(calcVlb &amp;lt;&amp;lt; delete());
				currCol = clb &amp;lt;&amp;lt; get selected();
				//currColName = char(currCol[1]);
				
				z_yyy = Eval(column(currCol));// Eval( {currCol} );
				z_xx = z_yyy &amp;lt;&amp;lt; get values;
				z_nnn = Eval( {:Nombre de seringues} );  //change back
				z_nn = z_nnn[1] &amp;lt;&amp;lt; get values;
				z_rrr = Eval( {:Numéro de lot} );    //change back

				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;

				show(currCol[1]);
				show(z_KSigmaZ);

				hlb &amp;lt;&amp;lt; append(
					calcVlb = vlistbox(
						textbox("Variables updated to column " || currCol[1]);
					)
				);
				
				/*calcVlb &amp;lt;&amp;lt; append(
					Distribution(
						Stack( 1 ),
						Continuous Distribution(
							Column( column(currCol[1])),
							Horizontal Layout( 1 ),
							Vertical( 0 ),
							PpK Capability Labeling( 0 ),
							Customize Summary Statistics(
								Std Err Mean( 0 ),
								Upper Mean Confidence Interval( 0 ),
								Lower Mean Confidence Interval( 0 ),
								N Missing( 1 ),
								Range( 1 )
							)
						)
					);
				);*/
				Graph_exprall=Expr(
					calcVlb &amp;lt;&amp;lt; append(
						Graphall = Control Chart(
								Sample Label( :Nombre de seringues ),
								Sample Size( :Numéro de lot ),
								KSigma(TBD),
								Sort by Row Order( 1 ),
							Chart Col( column(currCol[1]), P( Test Beyond Limits( 1 ), Limits Precision( 1 ), LCL( -3 ) ) ),
						SendToReport(
						Dispatch(
							{},
							String_TBD,
							OutlineBox,
							{Set Title( "p'-chart, Proportion de défaut" )}
						),
						Dispatch(
							{String_TBD},
							"2",
							ScaleBox,
							{Format( "Fixed Dec", 12, 5 ), Min( -0.00025 ), Max( 0.0025 ),
							Inc( 0.00025 ), Minor Ticks( 1 )}
						),
						Dispatch(
							{String_TBD},
							"1",
							ScaleBox,
							{Min( 0.5 ), Inc( 1 ), Minor Ticks( 0 )}
						),
						Dispatch(
							{String_TBD},
							"",
							AxisBox,
							{Add Axis Label( "Taux de défauts (srg)" )}
						)));
						//ColumnSwitcherObject = graphall &amp;lt;&amp;lt; Column Switcher( :"Y1"n,{:"Y2"n, :"Y3"n, :"Y4"n, :"Y5"n ,"Y6"n ,"Y7"n});	
					);
				);

				// On affecte le SigmaZ à la carte de controle
				olbString = "P of " || currCol[1];

				SubstituteInto(Graph_exprall, Expr(TBD), z_KSigmaZ);
				SubstituteInto(Graph_exprall, Expr(String_TBD), olbString);
				Graph_exprall;

				
			)
		)
	)
);



clb &amp;lt;&amp;lt; append(colList);
clb &amp;lt;&amp;lt; set selected(1);

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Apr 2022 18:35:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/480726#M72518</guid>
      <dc:creator>mikedriscoll</dc:creator>
      <dc:date>2022-04-20T18:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Script: Column switcher applied on a coefficient</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/480849#M72528</link>
      <description>&lt;P&gt;I believe that what you really need to use is&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;				z_yyy = Eval(column(currCol)&amp;lt;&amp;lt;get name);// Eval( {currCol} );
				z_xx = column(dt,z_yyy) &amp;lt;&amp;lt; get values;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;ait will return the values from the selected column&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 04:44:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/480849#M72528</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-04-21T04:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Script: Column switcher applied on a coefficient</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/481841#M72622</link>
      <description>&lt;P&gt;Great! It is working really well!&lt;/P&gt;&lt;P&gt;Thanks a lot for your help :)&lt;/img&gt;&lt;/P&gt;&lt;P&gt;Sebastien&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 11:50:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Script-Column-switcher-applied-on-a-coefficient/m-p/481841#M72622</guid>
      <dc:creator>Sebastienlg</dc:creator>
      <dc:date>2022-04-25T11:50:09Z</dc:date>
    </item>
  </channel>
</rss>

