Here is a sample script that will read in the values from a limits data table, and apply them to the measurement data table. And when the Variability Chart, or most other platform charts will display the spec limits.
// Open table to have limits set on
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// Create a limits table for the example
dtLimits = New Table( "Limits",
Add Rows( 2 ),
New Column( "Parameter", Character, "Nominal", Set Values( {"height", "weight"} ) ),
New Column( "LSL", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [52, 60] ) ),
New Column( "Target", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [63, 105] ) ),
New Column( "USL", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [70, 180] ) )
);
// Get a list of all of the numeric columns in the measurment data table
colNames = dt << get column names( numeric, string );
// Loop across the Limits table and apply the findings to data table
For( i = 1, i <= N Rows( dtLimits ), i++,
// If a column in the measurement data table has the same name as the current
// Limits data table column "Parameter" has, then process the data
colNamesPosition = Loc( colNames, dtLimits:Parameter[i] );
If( N Rows() > 0,
Eval(
Substitute(
Expr(
__col__ << set property(
"Spec Limits",
{LSL( __LSL__ ), USL( __USL__ ), Target( __Target__ ), Show Limits( 1 )}
)
),
Expr( __col__ ), Parse( "dt:" || colNames[colNamesPosition[1]] ),
Expr( __LSL__ ), dtLimits:LSL[i],
Expr( __USL__ ), dtLimits:USL[i],
Expr( __Target__ ), dtLimits:Target[i]
)
)
);
);
// Run Variability Charts
Variability Chart( Y( :height, :weight ), X( :sex ) );
Jim