Attached is an example of a script that turns limits off and on based upon the existing of external limits
Limits Exist:.....Control Chart
Limits Off: A Runs Chart
Names Default To Here( 1 );
// Create a sample limits table
dtLimits = New Table( "limits",
Add Rows( 2 ),
New Script( "Source", Data Table( "limits" ) << Update( With( Data Table( "Summary of Process Measurements" ) ) ) ),
New Column( "_LimitsKey",
Character,
"Nominal",
Set Property( "Value Order", {Numerical Order( 0 )} ),
Set Values( {"_LCL", "_UCL"} )
),
New Column( "Process 1", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [0.9, 21] ) ),
New Column( "Process 2", Numeric, "Continuous", Format( "Fixed Dec", 12, 3 ), Set Values( [13.95, 13.61] ) ),
New Column( "Process 3", Numeric, "Continuous", Format( "Fixed Dec", 12, 3 ), Set Values( [., .] ) ),
New Column( "Process 4", Numeric, "Continuous", Format( "Fixed Dec", 12, 3 ), Set Values( [8.39, 0.81] ) ),
New Column( "Process 5", Numeric, "Continuous", Format( "Fixed Dec", 12, 3 ), Set Values( [2.48, 0.00049] ) ),
New Column( "Process 6", Numeric, "Continuous", Format( "Fixed Dec", 12, 3 ), Set Values( [0.91, 0.55] ) ),
New Column( "Process 7", Numeric, "Continuous", Format( "Fixed Dec", 12, 3 ), Set Values( [11.45, 8.76] ) )
);
// Open the sample measurement table
dt = Open( "$SAMPLE_DATA/Process Measurements.jmp" );
// myList = {:Process 1, :Process 2, :Process 3, :Process 4, :Process 5, :Process 6, :Process 7};
myList = dt << get column names( continuous );
// Create the Control Chart
nw = New Window( "Report",
H List Box(
columnSwitcher = dt << Column Switcher( :Process 1, myList );
gb = Control Chart Builder(
Variables( Y( :Process 1 ) ),
Chart( Position( 1 ) ),
show two shewhart charts( 0 ),
Show Limit Summaries( 0 ),
Show Control Panel( 0 )
);
dis = Distribution(
Continuous Distribution( Column( :Process 1 ), Process Capability( Use Column Property Specs ) )
);
)
);
columnSwitcher << Link Platform( gb );
columnSwitcher << Link Platform( dis );
pre = Function( {currentColumn, nextColumn, switcher},
dtLimits << show window( 0 )
);
Post = Function( {currentColumn, nextColumn, switcher},
// Get path to set limits checkboxes
get_cbs = Expr(
tbs = Report( gb ) << XPath(
"//TextBox[contains(text(), 'Show Lower Limit') or contains(text(), 'Show Upper') or contains(text(), 'Show Center Line')]"
);
mbs = tbs << parent;
cbs = mbs << sib;
);
get_cbs;
// Check to see if limits exist in the limits table
If( Col Number( As Column( dtlimits, nextColumn << get name ) ) != 0,
// Limits Exist, therefore set the limits
For( i = 1, i <= N Items( cbs ), i++,
get_cbs;
cbs[i] << Set( 1, 1 );
),
// Limits do not exist, turn off the displaying of limits
For( i = 1, i <= N Items( cbs ), i++,
get_cbs;
cbs[i] << Set( 1, 0 );
)
);
nw << bring window to front;
);
columnSwitcher << Make Column Switch Handler( Pre, Post );
Jim