<?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: Loop function in Slider box in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Loop-function-in-Slider-box/m-p/563160#M77622</link>
    <description>&lt;P&gt;I would write a script like this quite differently than what you've done -- this helps separate the logic (the functions that do work) from the display tree, and flattens out the script.&amp;nbsp; It also has the added benefit that all functions are easily callable and sharable and not attached directly to button call-backs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But to answer your main question about lag, I'm honestly not sure.&amp;nbsp; It was hard for me to follow the execution path on your script which is why I re-wrote it, and the rewrite does not have the lag issue.&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 );


/*
	Here I use an anonymous namespace to scope all the variable and functions -- use Eval( Eval Expr( ... Expr( self &amp;lt;&amp;lt; Get Name ) ... ) ) where needed to put the reference inside funcitons and other scopes
*/

self = New Namespace();
self:dt Names = {};

For( t = 1, t &amp;lt;= N Table(), t++,
	Insert Into( self:dtNames, Data Table( t ) &amp;lt;&amp;lt; Get Name )
);

self:slider value = 1;
self:validated = 0;
self:_tables = {};

/*
	The Eval( Eval Expr( ... Expr( self &amp;lt;&amp;lt; Get Name ) ... ) ) part needs to encompass any functions and windows that the script will have.
	This is a bit unfortunate becuase it makes using this block inside rather tricky
*/
Eval( Eval Expr(
/****************************************
	Define the functions the script will use
****************************************/
self:add table = Function( {_table},
	Insert Into( self:_tables, _table );
	_table
);

self:update reference lines = Function( {},
	{Default Local},
	self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) );
	self:slider value = self:sb &amp;lt;&amp;lt; Get;
	self:tb &amp;lt;&amp;lt; Set Text( "Cpk: " || Char( self:slider value ) );

	Try(
		old lsl = self:lsl;
		old usl = self:usl;
	);
	self:limits table &amp;lt;&amp;lt; Rerun Formulas;
	self:lsl = Associative Array( self:limits table:Analysis Columns, self:limits table:LSL );
	self:usl = Associative Array( self:limits table:Analysis Columns, self:limits table:USL );
	Summation( i = 1, N Items( self:col ),
		If( Contains( self:lsl, self:col[i] ),
			Try( self:variability report[i][Axis Box( 1 )] &amp;lt;&amp;lt; Remove Ref Line( old lsl[self:col[i]] ) &amp;lt;&amp;lt; Remove Ref Line( old usl[self:col[i]] ) );
			
			/*
				Here I've done a bit of trickery because we're inside an Eval( Eval Expr( ... Expr( self &amp;lt;&amp;lt; Get Name ) ... ) ) block.
			*/
			dispatch = {};
			Insert Into( dispatch, Substitute( Eval List( {self:lsl[self:col[i]], "Solid", "Red", "LSL=" || Substr( Char( self:lsl[self:col[i]] ), 1, 5 ), 2} ), As Name( "List" ), As Name( "Add Ref Line" ) ) );
			Insert Into( dispatch, Substitute( Eval List( {self:usl[self:col[i]], "Solid", "Red", "New USL=" || Substr( Char( self:usl[self:col[i]] ), 1, 5 ), 2} ), As Name( "List" ), As Name( "Add Ref Line" ) ) );
			Eval List( Substitute( {Send( self:variability report[i][Axis Box( 1 )], _dispatch_ )}, As Name( "_dispatch_" ), dispatch ) );
		);
		0
	)
);

self:set limits = Function( {},
	{Default Local},
	self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) );
	Summation( i = 1, N Items( self:col ),
		If( Contains( self:aa_refs, self:col[i] ),
			self:variability report[i][Axis Box( 1 )] &amp;lt;&amp;lt; Min( self:aa_refs[self:col[i]] - 1 ) &amp;lt;&amp;lt; Max( self:aa_refs1[self:col[i]] + 1 );
			self:variability report[i][Frame Box( 1 )] &amp;lt;&amp;lt; DispatchSeg( CustomStreamSeg( 3 ), {Line Width( 2 )} );
			
			/*
				Here I've done a bit of trickery because we're inside an Eval( Eval Expr( ... Expr( self &amp;lt;&amp;lt; Get Name ) ... ) ) block
			*/
			dispatch = {};
			Insert Into( dispatch, Substitute( Eval List( {self:aa_refs[self:col[i]], "Solid", "Dark Green", "New LL=" || Substr( Char( self:aa_refs[self:col[i]] ), 1, 5 ), 2} ), As Name( "List" ), As Name( "Add Ref Line" ) ) );
			Insert Into( dispatch, Substitute( Eval List( {self:aa_refs1[self:col[i]], "Solid", "Dark Green", "New UL=" || Substr( Char( self:aa_Refs1[self:col[i]] ), 1, 5 ), 2} ), As Name( "List" ), As Name( "Add Ref Line" ) ) );
			Eval List( Substitute( {Send( self:variability report[i][Axis Box( 1 )], _dispatch_ )}, As Name( "_dispatch_" ), dispatch ) );
		);
		0
	)
);

/****************************************
	Modal input window
****************************************/
New Window( "Select Data Table",
	&amp;lt;&amp;lt; Modal
,
	&amp;lt;&amp;lt; On Validate(
		Local( {self = Namespace( Expr( self ) )},
			If( N Items( self:dt list box &amp;lt;&amp;lt; Get Selected ),
				self:validated = 1;
				self:dt = Data Table( (Insert( {}, self:dt list box &amp;lt;&amp;lt; Get Selected ))[1] );
				1
			,
				0
			)
		)
	)
,
	Panel Box( "Pick a Table", self:dt list box = List Box( self:dt names, Max Selected( 1 ) ) )
);

/****************************************
	Quit and delete namespace if not validated
****************************************/
If( Not( self:validated ),
	s = Char( "Delete Namespaces( \!"" || (self &amp;lt;&amp;lt; Get Name) || "\!", Force( 1 ) )" );
	self = .;
	Eval( Parse( s ) );
	Stop()
);

/****************************************
	Some initial setup
****************************************/
self:limits table = self:add table( Data Table( "Limits table" ) &amp;lt;&amp;lt; Subset( All Rows, All Columns, Not Linked, Private ) );
self:col = self:limits table:Analysis Columns &amp;lt;&amp;lt; Get Values;
self:col as name = {};
Summation( i = 1, N Items( self:col ),
	self:col as name[i] = As Name( self:col[i] );
	0
);
Try( self:limits table &amp;lt;&amp;lt; Delete Columns( "LSL" ) );
Try( self:limits table &amp;lt;&amp;lt; Delete Columns( "USL" ) );
Try( self:limits table &amp;lt;&amp;lt; Delete Table Variable( "cpk" ) );

self:limits table &amp;lt;&amp;lt; New Table Variable( "cpk", 1.33 )
	&amp;lt;&amp;lt; New Column( "LSL", "Numeric", "Continuous", Format( "Best", 12, 2 ), &amp;lt;&amp;lt;Formula( As Constant( self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) ) ); :Mean - self:slider value * 3 * :Std Dev ) )
	&amp;lt;&amp;lt; New Column( "USL", "Numeric", "Continuous", Format( "Best", 12, 2 ), &amp;lt;&amp;lt;Formula( As Constant( self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) ) ); :Mean + self:slider value * 3 * :Std Dev ) );

self:aa_refs = Associative Array( self:limits table:Analysis Columns, self:limits table:LL );
self:aa_refs1 = Associative Array( self:limits table:Analysis Columns, self:limits table:UL );


/****************************************
	Create main window -- this will close attached tables and delete the scoping namespace when closed
****************************************/
New Window( "WINDOW_NAME",
	&amp;lt;&amp;lt;On Close(
		Summation( i = 1, N Items( As Scoped( Expr( self &amp;lt;&amp;lt; Get Name ), "_tables" ) ),
			Close( As Scoped( Expr( self &amp;lt;&amp;lt; Get Name ), "_tables" )[i], No Save );
			0
		);
		Delete Namespaces( Expr( self &amp;lt;&amp;lt; Get Name ), Force( 1 ) );
	)
,
	H List Box(
		V List Box(
			Spacer Box( Size( 10, 10 ) )
		,
			Border Box( Sides( 15 ),
				V List Box(
					Spacer Box( Size( 0, 30 ) )
				,
					self:tb = Text Box( "Cpk: " || Char( self:slider value ), &amp;lt;&amp;lt;Set Font Style( "Bold" ) )
				,
					Spacer Box( Size( 0, 5 ) )
				,
					self:sb = Slider Box( 1, 3, self:slider value, &amp;lt;&amp;lt;Set Function( Function( {this}, Local( {self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) )}, self:update reference lines ) ) ) )
				,
				)
			)
		)
	,
		V Scroll Box(
			Outline Box( "",
				Platform( self:dt,
					self:variability chart = Variability Chart(
						Y( Eval( self:col as name ) ),
						X( :site ),
						Show Range Bars( 0 ),
						Show Grand Mean( 1 ),
						Std Dev Chart( 0 ),
						Points Jittered( 1 ),
						Show Box Plots( 1 ),
						SendToReport(
							Dispatch(
								{""},
								"Variability Chart",
								FrameBox,
								{Frame Size( 846, 318 ), Row Legend(
									Split,
									Color( 1 ),
									Color Theme( "JMP Default" ),
									Marker( 0 ),
									Marker Theme( "" ),
									Continuous Scale( 0 ),
									Reverse Scale( 0 ),
									Excluded Rows( 0 )
								)}
							)
						)
					)
				)
			)
		)
	)
);


/****************************************
	finalize the script after the display tree has been generated
****************************************/
self:variability report = self:variability chart &amp;lt;&amp;lt; Report;
self:set limits;
self:update reference lines;

) )&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 02 Nov 2022 04:03:23 GMT</pubDate>
    <dc:creator>ErraticAttack</dc:creator>
    <dc:date>2022-11-02T04:03:23Z</dc:date>
    <item>
      <title>Loop function in Slider box</title>
      <link>https://community.jmp.com/t5/Discussions/Loop-function-in-Slider-box/m-p/562988#M77608</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&amp;nbsp;I want to add ref line to several axis box and vary the reference line with slider box.&amp;nbsp;I am wondering if loop can be used?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Here's my code:- I was able to add reference line to each of the charts but the issue I face is when I vary the slider box, the loop functions takes a while to add a reference line and it's glitchy. Any other alternate way to implement? I appreciate if you could advice. Thanks&amp;nbsp;&lt;BR /&gt;I've attached both data tables below&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dtNames = {};
For( t = 1, t &amp;lt;= N Table(), t++,
	Insert Into( dtNames, Data Table( t ) &amp;lt;&amp;lt; getName )
);
sliderValue = 1;
dothisonchange = Function( {val},
	tb &amp;lt;&amp;lt; Set Text( "Cpk : " || Substr( Char( val ), 1, 4 ) )
);&lt;BR /&gt;//// Select Measurement data table
nw = New Window( "Select Data Table",
	modal,
	Panel Box( "Pick a table", dtlb = List Box( dtNames, MaxItems( 1 ) ) ),
	Button Box( "OK",
		dtl = dtlb &amp;lt;&amp;lt; getSelected;
		dt = Data Table( dtl[1] );
		dt2 = Data Table( "Limits table" );
		col = dt2:Analysis Columns &amp;lt;&amp;lt; get values;
		colist = {};
		dt3 = dt2;
		cpktab = Data Table( "Limits table" );
		Try(
			cpktab &amp;lt;&amp;lt; delete columns( "LSL" );
			cpktab &amp;lt;&amp;lt; delete columns( "USL" );
			cpktab &amp;lt;&amp;lt; Delete Table Variable( "cpk" );
		);
		cpktab &amp;lt;&amp;lt; New Table Variable( "cpk", 1.33 );
		cpktab &amp;lt;&amp;lt; New Column( "LSL", "Numberic", "Continous", Format( "Best", 12, 2 ), Formula( :Mean - cpk * 3 * :Std Dev ) );
		cpktab &amp;lt;&amp;lt; New Column( "USL", "Numberic", "Continous", Format( "Best", 12, 2 ), Formula( :Mean + cpk * 3 * :Std Dev ) );
		Caption( "Processing...Please Wait" );
		Wait( 0 );
		New Window( "",
			H List Box(
				V List Box(
					Spacer Box( size( 10, 10 ) ),
					Panel Box( "", 

						Spacer Box( size( 0, 30 ) ),
						tb = Text Box( "Cpk: " || Char( sliderValue ), &amp;lt;&amp;lt;Set Font Style( "Bold" ) ), 
						Spacer Box( size( 0, 5 ) ),
						sb = Slider Box(
							1,
							3,
							sliderValue,
							&amp;lt;&amp;lt;Set function(
								Function( {this}, 
									
									sliderValue = this &amp;lt;&amp;lt; Get;
									p = sliderValue;
									dt3:cpk = p;
									lsl = Associative Array( dt3:Analysis Columns &amp;lt;&amp;lt; get values, dt3:LSL &amp;lt;&amp;lt; get values );
									usl = Associative Array( dt3:Analysis Columns &amp;lt;&amp;lt; get values, dt3:USL &amp;lt;&amp;lt; get values );
									sb &amp;lt;&amp;lt; Set( sliderValue );
									dothisonchange( sliderValue );&lt;BR /&gt;//////////////////////////////////// This function lags////////////////////////////////////
									For( i = 1, i &amp;lt;= N Items( col ), i++,
										If( Contains( lsl, col[i] ),
											Report( vc2[i] )[AxisBox( 1 )] &amp;lt;&amp;lt; remove ref line( lsl[col[i]] );
											Report( vc2[i] )[AxisBox( 1 )] &amp;lt;&amp;lt; remove ref line( usl[col[i]] );
										
											Report( vc2[i] )[AxisBox( 1 )] &amp;lt;&amp;lt; {Add Ref Line(
												lsl[col[i]], "Solid", "Red", "LSL=" || Substr( Char( lsl[col[i]] ), 1, 5 ), 2
											)};
											Report( vc2[i] )[AxisBox( 1 )] &amp;lt;&amp;lt; {Add Ref Line(
												usl[col[i]], "Solid", "Red", "New USL=" || Substr( Char( usl[col[i]] ), 1, 5 ), 2
											)};
										)
									);
								)
							)
						)
					)
				),
				vc2 = dt &amp;lt;&amp;lt; Variability Chart(
					Y( Eval( col ) ),
					X( :site ),
					Show Range Bars( 0 ),
					Show Grand Mean( 1 ),
					Std Dev Chart( 0 ),
					Points Jittered( 1 ),
					Show Box Plots( 1 ),
					SendToReport(
						Dispatch(
							{""},
							"Variability Chart",
							FrameBox,
							{Frame Size( 846, 318 ), Row Legend(
								Split,
								Color( 1 ),
								Color Theme( "JMP Default" ),
								Marker( 0 ),
								Marker Theme( "" ),
								Continuous Scale( 0 ),
								Reverse Scale( 0 ),
								Excluded Rows( 0 )
							)}
						)
					)
				);
				aa_refs = Associative Array( dt3:Analysis Columns &amp;lt;&amp;lt; get values, dt3:LL &amp;lt;&amp;lt; get values );
				aa_refs1 = Associative Array( dt3:Analysis Columns &amp;lt;&amp;lt; get values, dt3:UL &amp;lt;&amp;lt; get values );
				For( i = 1, i &amp;lt;= N Items( col ), i++,
					If( Contains( aa_refs, col[i] ),
						Report( vc2[i] )[Framebox( 1 )] &amp;lt;&amp;lt; DispatchSeg( CustomStreamSeg( 3 ), {Line Width( 2 )} );
						Report( vc2[i] )[AxisBox( 1 )] &amp;lt;&amp;lt; {Add Ref Line(
							aa_refs[col[i]], "Solid", "Dark Green", "New LL=" || Substr( Char( aa_refs[col[i]] ), 1, 5 ), 2
						)};
						Report( vc2[i] )[AxisBox( 1 )] &amp;lt;&amp;lt; {Add Ref Line(
							aa_refs1[col[i]], "Solid", "Dark Green", "New UL=" || Substr( Char( aa_refs1[col[i]] ), 1, 5 ), 2
						)};
					)
				);
				Try( vcidd = vc2 &amp;lt;&amp;lt; report );
				For( i = 1, i &amp;lt;= N Items( col ), i++,
					If( Contains( aa_refs, col[i] ),
						vcidd[i][AxisBox( 1 )] &amp;lt;&amp;lt; Min( aa_refs[col[i]] - 1 ) &amp;lt;&amp;lt; Max( aa_refs1[col[i]] + 1 )
					)
				);
				Caption( remove );
				Wait( 0 );
			)
		);
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:01:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Loop-function-in-Slider-box/m-p/562988#M77608</guid>
      <dc:creator>Jackie_</dc:creator>
      <dc:date>2023-06-09T16:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: Loop function in Slider box</title>
      <link>https://community.jmp.com/t5/Discussions/Loop-function-in-Slider-box/m-p/563056#M77613</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/70"&gt;@gzmorgan0&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;any advice?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 19:43:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Loop-function-in-Slider-box/m-p/563056#M77613</guid>
      <dc:creator>Jackie_</dc:creator>
      <dc:date>2022-11-01T19:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: Loop function in Slider box</title>
      <link>https://community.jmp.com/t5/Discussions/Loop-function-in-Slider-box/m-p/563160#M77622</link>
      <description>&lt;P&gt;I would write a script like this quite differently than what you've done -- this helps separate the logic (the functions that do work) from the display tree, and flattens out the script.&amp;nbsp; It also has the added benefit that all functions are easily callable and sharable and not attached directly to button call-backs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But to answer your main question about lag, I'm honestly not sure.&amp;nbsp; It was hard for me to follow the execution path on your script which is why I re-wrote it, and the rewrite does not have the lag issue.&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 );


/*
	Here I use an anonymous namespace to scope all the variable and functions -- use Eval( Eval Expr( ... Expr( self &amp;lt;&amp;lt; Get Name ) ... ) ) where needed to put the reference inside funcitons and other scopes
*/

self = New Namespace();
self:dt Names = {};

For( t = 1, t &amp;lt;= N Table(), t++,
	Insert Into( self:dtNames, Data Table( t ) &amp;lt;&amp;lt; Get Name )
);

self:slider value = 1;
self:validated = 0;
self:_tables = {};

/*
	The Eval( Eval Expr( ... Expr( self &amp;lt;&amp;lt; Get Name ) ... ) ) part needs to encompass any functions and windows that the script will have.
	This is a bit unfortunate becuase it makes using this block inside rather tricky
*/
Eval( Eval Expr(
/****************************************
	Define the functions the script will use
****************************************/
self:add table = Function( {_table},
	Insert Into( self:_tables, _table );
	_table
);

self:update reference lines = Function( {},
	{Default Local},
	self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) );
	self:slider value = self:sb &amp;lt;&amp;lt; Get;
	self:tb &amp;lt;&amp;lt; Set Text( "Cpk: " || Char( self:slider value ) );

	Try(
		old lsl = self:lsl;
		old usl = self:usl;
	);
	self:limits table &amp;lt;&amp;lt; Rerun Formulas;
	self:lsl = Associative Array( self:limits table:Analysis Columns, self:limits table:LSL );
	self:usl = Associative Array( self:limits table:Analysis Columns, self:limits table:USL );
	Summation( i = 1, N Items( self:col ),
		If( Contains( self:lsl, self:col[i] ),
			Try( self:variability report[i][Axis Box( 1 )] &amp;lt;&amp;lt; Remove Ref Line( old lsl[self:col[i]] ) &amp;lt;&amp;lt; Remove Ref Line( old usl[self:col[i]] ) );
			
			/*
				Here I've done a bit of trickery because we're inside an Eval( Eval Expr( ... Expr( self &amp;lt;&amp;lt; Get Name ) ... ) ) block.
			*/
			dispatch = {};
			Insert Into( dispatch, Substitute( Eval List( {self:lsl[self:col[i]], "Solid", "Red", "LSL=" || Substr( Char( self:lsl[self:col[i]] ), 1, 5 ), 2} ), As Name( "List" ), As Name( "Add Ref Line" ) ) );
			Insert Into( dispatch, Substitute( Eval List( {self:usl[self:col[i]], "Solid", "Red", "New USL=" || Substr( Char( self:usl[self:col[i]] ), 1, 5 ), 2} ), As Name( "List" ), As Name( "Add Ref Line" ) ) );
			Eval List( Substitute( {Send( self:variability report[i][Axis Box( 1 )], _dispatch_ )}, As Name( "_dispatch_" ), dispatch ) );
		);
		0
	)
);

self:set limits = Function( {},
	{Default Local},
	self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) );
	Summation( i = 1, N Items( self:col ),
		If( Contains( self:aa_refs, self:col[i] ),
			self:variability report[i][Axis Box( 1 )] &amp;lt;&amp;lt; Min( self:aa_refs[self:col[i]] - 1 ) &amp;lt;&amp;lt; Max( self:aa_refs1[self:col[i]] + 1 );
			self:variability report[i][Frame Box( 1 )] &amp;lt;&amp;lt; DispatchSeg( CustomStreamSeg( 3 ), {Line Width( 2 )} );
			
			/*
				Here I've done a bit of trickery because we're inside an Eval( Eval Expr( ... Expr( self &amp;lt;&amp;lt; Get Name ) ... ) ) block
			*/
			dispatch = {};
			Insert Into( dispatch, Substitute( Eval List( {self:aa_refs[self:col[i]], "Solid", "Dark Green", "New LL=" || Substr( Char( self:aa_refs[self:col[i]] ), 1, 5 ), 2} ), As Name( "List" ), As Name( "Add Ref Line" ) ) );
			Insert Into( dispatch, Substitute( Eval List( {self:aa_refs1[self:col[i]], "Solid", "Dark Green", "New UL=" || Substr( Char( self:aa_Refs1[self:col[i]] ), 1, 5 ), 2} ), As Name( "List" ), As Name( "Add Ref Line" ) ) );
			Eval List( Substitute( {Send( self:variability report[i][Axis Box( 1 )], _dispatch_ )}, As Name( "_dispatch_" ), dispatch ) );
		);
		0
	)
);

/****************************************
	Modal input window
****************************************/
New Window( "Select Data Table",
	&amp;lt;&amp;lt; Modal
,
	&amp;lt;&amp;lt; On Validate(
		Local( {self = Namespace( Expr( self ) )},
			If( N Items( self:dt list box &amp;lt;&amp;lt; Get Selected ),
				self:validated = 1;
				self:dt = Data Table( (Insert( {}, self:dt list box &amp;lt;&amp;lt; Get Selected ))[1] );
				1
			,
				0
			)
		)
	)
,
	Panel Box( "Pick a Table", self:dt list box = List Box( self:dt names, Max Selected( 1 ) ) )
);

/****************************************
	Quit and delete namespace if not validated
****************************************/
If( Not( self:validated ),
	s = Char( "Delete Namespaces( \!"" || (self &amp;lt;&amp;lt; Get Name) || "\!", Force( 1 ) )" );
	self = .;
	Eval( Parse( s ) );
	Stop()
);

/****************************************
	Some initial setup
****************************************/
self:limits table = self:add table( Data Table( "Limits table" ) &amp;lt;&amp;lt; Subset( All Rows, All Columns, Not Linked, Private ) );
self:col = self:limits table:Analysis Columns &amp;lt;&amp;lt; Get Values;
self:col as name = {};
Summation( i = 1, N Items( self:col ),
	self:col as name[i] = As Name( self:col[i] );
	0
);
Try( self:limits table &amp;lt;&amp;lt; Delete Columns( "LSL" ) );
Try( self:limits table &amp;lt;&amp;lt; Delete Columns( "USL" ) );
Try( self:limits table &amp;lt;&amp;lt; Delete Table Variable( "cpk" ) );

self:limits table &amp;lt;&amp;lt; New Table Variable( "cpk", 1.33 )
	&amp;lt;&amp;lt; New Column( "LSL", "Numeric", "Continuous", Format( "Best", 12, 2 ), &amp;lt;&amp;lt;Formula( As Constant( self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) ) ); :Mean - self:slider value * 3 * :Std Dev ) )
	&amp;lt;&amp;lt; New Column( "USL", "Numeric", "Continuous", Format( "Best", 12, 2 ), &amp;lt;&amp;lt;Formula( As Constant( self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) ) ); :Mean + self:slider value * 3 * :Std Dev ) );

self:aa_refs = Associative Array( self:limits table:Analysis Columns, self:limits table:LL );
self:aa_refs1 = Associative Array( self:limits table:Analysis Columns, self:limits table:UL );


/****************************************
	Create main window -- this will close attached tables and delete the scoping namespace when closed
****************************************/
New Window( "WINDOW_NAME",
	&amp;lt;&amp;lt;On Close(
		Summation( i = 1, N Items( As Scoped( Expr( self &amp;lt;&amp;lt; Get Name ), "_tables" ) ),
			Close( As Scoped( Expr( self &amp;lt;&amp;lt; Get Name ), "_tables" )[i], No Save );
			0
		);
		Delete Namespaces( Expr( self &amp;lt;&amp;lt; Get Name ), Force( 1 ) );
	)
,
	H List Box(
		V List Box(
			Spacer Box( Size( 10, 10 ) )
		,
			Border Box( Sides( 15 ),
				V List Box(
					Spacer Box( Size( 0, 30 ) )
				,
					self:tb = Text Box( "Cpk: " || Char( self:slider value ), &amp;lt;&amp;lt;Set Font Style( "Bold" ) )
				,
					Spacer Box( Size( 0, 5 ) )
				,
					self:sb = Slider Box( 1, 3, self:slider value, &amp;lt;&amp;lt;Set Function( Function( {this}, Local( {self = Namespace( Expr( self &amp;lt;&amp;lt; Get Name ) )}, self:update reference lines ) ) ) )
				,
				)
			)
		)
	,
		V Scroll Box(
			Outline Box( "",
				Platform( self:dt,
					self:variability chart = Variability Chart(
						Y( Eval( self:col as name ) ),
						X( :site ),
						Show Range Bars( 0 ),
						Show Grand Mean( 1 ),
						Std Dev Chart( 0 ),
						Points Jittered( 1 ),
						Show Box Plots( 1 ),
						SendToReport(
							Dispatch(
								{""},
								"Variability Chart",
								FrameBox,
								{Frame Size( 846, 318 ), Row Legend(
									Split,
									Color( 1 ),
									Color Theme( "JMP Default" ),
									Marker( 0 ),
									Marker Theme( "" ),
									Continuous Scale( 0 ),
									Reverse Scale( 0 ),
									Excluded Rows( 0 )
								)}
							)
						)
					)
				)
			)
		)
	)
);


/****************************************
	finalize the script after the display tree has been generated
****************************************/
self:variability report = self:variability chart &amp;lt;&amp;lt; Report;
self:set limits;
self:update reference lines;

) )&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Nov 2022 04:03:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Loop-function-in-Slider-box/m-p/563160#M77622</guid>
      <dc:creator>ErraticAttack</dc:creator>
      <dc:date>2022-11-02T04:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: Loop function in Slider box</title>
      <link>https://community.jmp.com/t5/Discussions/Loop-function-in-Slider-box/m-p/563345#M77634</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thanks so much. You've been really helpful.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 12:38:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Loop-function-in-Slider-box/m-p/563345#M77634</guid>
      <dc:creator>Jackie_</dc:creator>
      <dc:date>2022-11-02T12:38:58Z</dc:date>
    </item>
  </channel>
</rss>

