Depending on your analysis, you could add new column for each measurement or stack your table first and create single new column.
Adding new columns for each parameter
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
cont_cols = dt << Get Column Names("Continuous", "String");
cols_created = {};
For Each({cont_col}, cont_cols,
specs = Column(dt, cont_col) << Get Property("Spec Limits");
If(Is Empty(specs), // skip columns without specs
Continue();
);
cur_target = Try(specs["Target"], .); // If target isn't set -> use 0 (could for example use USL - LSL?)
new_col = Eval(Substitute( // generally I use Eval(EvalExpr()) but in this case this makes expression more clear
Expr(dt << New Column(cont_col || " Minus Target", Numeric, Continuos, Formula(
_curcol_ - _targetval_
))),
Expr(_curcol_), Name Expr(AsColumn(dt, cont_col)),
Expr(_targetval_), cur_target
));
// new_col << Suppress Eval(1);
Insert Into(cols_created, new_col << get name);
);
and you end up with columns like this (target won't be updated IF you change the column property)
Stacking
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
cont_cols = dt << Get Column Names("Continuous", "String");
ml = dt << Manage Limits(Process Variables(Eval(cont_cols))); // in this case this will open very annoying "help" window due to inconsistencies
dt_limits = ml << Save to Tall Limits Table;
ml << close window;
dt_stack = dt << Stack(
columns(Eval(cont_cols)),
Source Label Column("Measurement"),
Stacked Data Column("Data"),
Output Table("Data Stacked")
);
// If you don't care about LSL/USL they could be dropped from update
dt_stack << Update(
With(dt_limits),
Match Columns(:Measurement = :Variable),
Replace Columns in Main Table(None)
);
dt_stack << New Column("Data Minus Target", Numeric, Continuous, Formula(
:Data - :Target
));
Both data formats have their pros and cons which depends on what you are doing.
Edit:
This should get the values from column property BUT it won't re-evaluate (I wouldn't really use this if you can avoid it)
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
cont_cols = dt << Get Column Names("Continuous", "String");
cols_created = {};
For Each({cont_col}, cont_cols,
specs = Column(dt, cont_col) << Get Property("Spec Limits");
If(Is Empty(specs), // skip columns without specs
Continue();
);
new_col = Eval(Substitute( // generally I use Eval(EvalExpr()) but in this case this makes expression more clear
Expr(dt << New Column(cont_col || " Minus Target", Numeric, Continuos, Formula(
_curcol_ - (_curcol_ << Get Property("Spec Limits"))["Target"]
))),
Expr(_curcol_), Name Expr(AsColumn(dt, cont_col))
));
//new_col << Suppress Eval(1);
Insert Into(cols_created, new_col << get name);
);
-Jarmo