cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
clausa
Level III

JSL Turning on Spec Limits "Show as Graph Reference Lines"

I have a great script I borrowed from somewhere to import multiple spec limits and assign them to the each column. Is there a way when editing a column's specification to also check the box unders Spec Limits for "Show as Graph Reference Lines"? Right now I have to do this manually.

 

jmp spec limits graph reference lines.png

 

dt = Current Data Table();
dt2 = Open();
Current Data Table( dt );
nw = New Window( "Select Process Variables",
	Text Box( "Selection Columns" ),
	H List Box(
		datacolbox = Col List Box( all ),
		Button Box( "Process Variables",
			pList << append( datacolbox << get selected )
		),
		pList = List Box( {} )
	),
	Button Box( "OK",
		thelist = plist << get items;
		pvars = ":" || thelist[1];
		For( i = 2, i <= N Items( thelist ), i++,
			pvars = pvars || ",:" || thelist[i]
		);
		Eval(
			Parse(
				"obj = dt << Process Capability(
	Process Variables(" || pvars ||
				" ),
	Spec Limits( Import Spec Limits( dt2 ) )
);"
			)
		);
		obj << Save Spec Limits as Column Properties;
		obj << close window;
		nw << close window;
	)
);

Thanks!

1 REPLY 1
txnelson
Super User

Re: JSL Turning on Spec Limits "Show as Graph Reference Lines"

If I am interpreting your code properly, what you are doing is copying your limits from the limits table, into the column properties for your data table.  If this is the case, you may want to look at the Manage Spec Limits capability in JMP 14

Manage Spec Limits(  );

However, if you just want to continue the way you are doing it, here is a modification of your script that will set the Show Limits

Names Default To Here( 1 );
dt = open();
dt2 = Data Table( "limits" );
Current Data Table( dt );
nw = New Window( "Select Process Variables",
	Text Box( "Selection Columns" ),
	H List Box(
		datacolbox = Col List Box( all ),
		Button Box( "Process Variables", pList << append( datacolbox << get selected ) ),
		pList = List Box( {} )
	),
	Button Box( "OK",
		thelist = plist << get items;
		// Loop across all of the item is theList and process
		// the data
		For( i = 1, i <= N Items( theList ), i++,
			theRow = dt2 << get rows where( :Process == theList[i] );
			If( N Rows( theRow ) > 0, 
				// Change theRow to a scaler
				theRow = theRow[1];
				// Set the spec limits in the dt data table by reading
				// the values from the dt2(limits) data table
				Eval(
					Substitute(
							Expr(
								Column( dt, theList[i] ) <<
								set property(
									"spec limits",
									{__LSL__, __USL__, __Target__, Show Limits( 1 )}
								)
							),
						Expr( __LSL__ ), Column( dt2, "LSL" )[theRow],
						Expr( __USL__ ), Column( dt2, "USL" )[theRow],
						Expr( __Target__ ), Column( dt2, "Target" )[theRow]
					)
				);
			);
		);
		
		nw << close window;
	)
);
Jim