Dec 8, 2016 10:40 AM
| Last Modified: Dec 8, 2016 10:38 AM
Some quick notes on adding spec limit lines to all the columns in a table with spec limitsWhen specification limits are defined in the properties of a column, it is often convenient to have the spec limits drawn as reference lines on the graphs for that column. In the column properties for Spec Limits, there is a check box that will cause the specification for that column to be used anytime the column is used on a graph. One might want to check that little box on a whole raft of columns that have specifications. Manually this would be tedious so here is a little bit of JSL to accomplish this this task.
The script collects a list of columns that are continuous. (character and nominal columns wouldn't have specs anyway.)
The script gets the Spec Limits column property from each column column in the list. The function, Get Column Properties, gets all the properties, but that's not what we want here so we pull just the spec limit property. If there is no Spec Limit property, then Empty() is returned. Next the script inserts y, which is an unevaluated expression containing "show limits(1)" into the list that came from the Spec Limits property. Finally the script sets the new Spec Limit property back to the column it started with... unless the Spec Limit property is an expression rather than a list.
Issues with Types of column properties?
There are two ways to have a column property set up
...checks to see if the specification property is the expression type. Then inserts the components of the argument into a list. After deleting the existing property, the new list type property is added back.
This is the script to standarized the specification column property type
dt=current data table();
collist=dt<<get column names( Continuous );
for (i =1 , i<=nitems(collist), i++,
a=collist[i]<<get property("Spec Limits");
insert into(a, nameexpr(y));
if (Head Name Expr(a)=="Spec Limits",
collist[i]<< Delete Property( "Spec Limits" );
collist[i]<<set property("Spec Limits", eval(aa)),
collist[i]<<set property("Spec Limits", eval(a))
For testing: This is a reduced test case to use as an example. This bit of JSL makes a new table with the two different types of spec property formats.