Subscribe Bookmark RSS Feed

Automate a Gauge R&R with many measurement columns

jjhartwi

Community Trekker

Joined:

Jun 19, 2014

I would like to know if you can take a "spec limit" file that is used to add limits to a capability study and use it to add limits  to the column properties all at once to perform a gauge R&R without inputting them in one by one.  I would like to get a precision to tolerance ratio and need the spec limits for all of the columns.

3 REPLIES
ian_jmp

Staff

Joined:

Jun 23, 2011

In the code below 'dt' ('dt1') is a reference to the table containing the data (the spec limits). To use the code, do 'File > New > New Script', cut and paste into the window that appears, then do 'Edit > Run Script'.

NamesDefaultToHere(1);

// Make some spec limits to work with

dt1 =

New Table( "Spec Limits",

Add Rows( 3 ),

New Column( "Process",

Character,

"Nominal",

Set Values( {"NPN1", "PNP1", "PNP2"} )

),

New Column( "LSL",

Numeric,

"Continuous",

Set Values( [104.412948990151, 164.389518443879, -136.122122529984] )

),

New Column( "Target",

Numeric,

"Continuous",

Set Values( [118.153221027253, 297.017932186294, 465.441998810449] )

),

New Column( "USL",

Numeric,

"Continuous",

Set Values( [131.893493064355, 429.64634592871, 1067.00612015088] )

)

);

// Make some data to work with

dt =

New Table( "Data",

Add Rows( 10 ),

New Column("NPN1",

Numeric,

"Continuous",

Set Values(

[114.555760105678, 120.043693059459, 114.926510466106, 111.756445551183,

111.545085144313, 113.52359591958, 111.749308571209, 114.411433304976,

118.48975048042, 113.171122695149]

)

),

New Column("PNP1",

Numeric,

"Continuous",

Set Values(

[322.616751775796, 333.128079728678, 348.978757216574, 268.548094462492,

295.073165929223, 323.833298568833, 369.320490694357, 342.987400315929,

315.52243608245, 288.978183718528]

)

),

New Column("PNP2",

Numeric,

"Continuous",

Set Values(

[469.390289765043, 437.781112798903, 532.12814730405, 373.058628529111,

338.900737368942, 469.992171436316, 563.084459366587, 479.378108668814,

530.265608347575, 421.454501563007]

)

)

);

// ******************************************************************************************

// Given a column reference, sets spec liomits property

// ******************************************************************************************

setSpecLimits = function({c, lsl, usl, tar},

     cmd = Expr(c << SetProperty("Spec Limits", {LSL(expr(lsl)), USL(expr(usl)), Target(expr(tar))}));

     eval(evalexpr(cmd));

);

// ******************************************************************************************

// Given a table dt, and a table dt1 containing spec limits, populates spec limit properties in dt

// ******************************************************************************************

populateSpecs = Function({dt, dt1}, {Default Local},

// Loop over rows of dt1, and iff there is a matching column in dt set its property

clist = dt << GetColumnNames(Numeric, String);

for (r=1, r<=NRows(dt1), r++,

name = Column(dt1, "Process")[r];

lsl = Column(dt1, "LSL")[r];

usl = Column(dt1, "USL")[r];

tar = Column(dt1, "Target")[r];

if (Contains(clist, name), SetSpecLimits(Column(dt, name), lsl, usl, tar));

)

);

// Define the spec limit column properties in dt using dt1

Wait(3);

populateSpecs(dt, dt1);

// Launch the Capability platform (which uses the column properties automatically)

cols = dt << getColumnNames;

dt << Capability(Y(Eval(cols)));

mark_dayton1

Community Member

Joined:

Sep 11, 2014

The populateSpecs no longer works in JMP 13 (unless I'm doing something wrong). I tried to "fix" it, but it doesn't work. I assume that it has to do with evaluating the current values of lsl, usl, and tar in the loop, but I can't figure out how to make it work. Suggestions?

 

 

// ******************************************************************************************
// Given a table dt, and a table dt1 containing spec limits, populates spec limit properties in dt
// ******************************************************************************************
populateSpecs = Function({dt, dt1}, {Default Local},
	// Loop over rows of dt1, and iff there is a matching column in dt set its property
	clist = dt << GetColumnNames(Numeric, String);
	for (r=1, r<=NRows(dt1), r++,
		name = Column(dt1, "Variable")[r];
		lsl = Column(dt1, "LSL")[r];
		usl = Column(dt1, "USL")[r];
		tar = Column(dt1, "Target")[r];
		if (Contains(clist, name), Column(dt, name) << Set Property ( "Spec Limits",
			{LSL( lsl ), USL( usl ), Target( tar ), Show Limits( 1 )})
		)
	)
);

 

MarkDayton

Established Member

Joined:

Feb 13, 2017

nevermind, I figured it out on my own:

 

populateSpecs = Function({dt, dt1}, {Default Local},
	// Loop over rows of dt1, and iff there is a matching column in dt set its property
	clist = dt << GetColumnNames(Numeric, String);
	for (r=1, r<=NRows(dt1), r++,
		name = Column(dt1, "Variable")[r];
		lsl = Column(dt1, "LSL")[r];
		usl = Column(dt1, "USL")[r];
		tar = Column(dt1, "Target")[r];
		Eval(
			Eval Expr(
				if (Contains(clist, name), Column(dt, name) << Set Property ( "Spec Limits",
					{LSL( Expr(lsl) ), USL( Expr(usl) ), Target( Expr(tar) ), Show Limits( 1 )})
				)
			)
		)
	)
);