Formazione di una formula di colonna da un array associativoHo cercato ma non sono riuscito a trovare un esempio chiaro. Ho uno script che crea un array associativo tra coppie di colonne in una tabella. Ora voglio sfruttare quell'array per creare una formula che faccia riferimento sia al valore che alla chiave. Come si fa?
For( i = 1, i <= N Items( SpecCols ), i++,
key = Column( dt, SpecCols[i] );
value = Column( dt, Char(SpecCols[i])||" Pass/Fail");
assocArray[key] = value;
dt << New Column( (Column( dt, SpecCols[i] ) << get name) || " Best",
Set Property( "Notes", Notes ),
Set Property( "Limits", Limits ),
Formula(If(
:RETEST == Col Minimum(
If(
Col Mean( value, :LOT, :WAFER, :RETEST ) ==
Eval( Parse( value)),
:RETEST
),
:LOT,
:WAFER,
:SiteY,
:SiteX
),
Eval( Parse(key))
))
);
);
Automazione e scriptingRe: Formazione di una formula di colonna da un array associativoValutazione dell'espressione e in casi come questo mi piace usare Eval(Substitute())
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
aa = Associative Array();
aa["NPN1"] = "NPN2";
aa["PNP1"] = "PNP2";
aa["INM1"] = "INM2";
new_cols = {};
For Each({{key, val}}, aa,
new_col = Eval(Substitute(
Expr(dt << New Column(key ||" "|| val, Numeric, Continuous, Formula(
_term1_ + _term2_
))),
Expr(_term1_), Name Expr(AsColumn(dt, key)),
Expr(_term2_), Name Expr(AsColumn(dt, val))
));
Insert Into(new_cols, (new_col << get name))
);
dt << Move Selected Columns(new_cols, To First);