Hi,
I want to have a dialog to set specification limits. That dialog works ok (it Returns the values in the log), but now I want to add those returned values to my specification Limits of the first column. I can do so when using real number like 1, 2, 3, but not with my variable names lsl, target, usl.
I found a script from Ian for Setting properties and the function SetSpecLimits does what it should and helped me out. But still I'm wondering why I cannot set a variable as Input for a value?
Any help is highly appreciated. .
Clear Globals();
New Table( "Test", Add Rows( 25 ),
New Column( "measure", Numeric, "Continuous",
Format( "Best", 10 ),
[0.497469677124172, 0.320808149408549, 0.030875115422532,
0.540292485617101, 0.774240606930107, 0.71451562223956,
0.243951379321516, 0.529565613949671, 0.450062318705022,
0.690511454129592, 0.00942516978830099, 0.531793952453881,
0.617926313076168, 0.0934034239035099, 0.273237543879077,
0.32646171329543, 0.582322434755042, 0.817773777991533,
0.448921825736761, 0.50579765625298, 0.992056015878916,
0.868506029713899, 0.691899508936331, 0.116229122737423,
0.109570041298866]));
col = Column(1);
result=New Window( "Set Spec Limits",
<<Modal,
<<Return Result,
V List Box(
Lineup Box(NCol(2),
Text Box("LSL"), num1=Number Edit Box(0.3),
Text Box("Target"), num2 = Number Edit Box(0.5),
Text Box("USL"), num3 = Number Edit Box(0.7)),
H List Box(
Button Box("OK"),
Button Box("Cancel"))
);
lsl = result["num1"];
target = result["num2"];
usl = result["num3"];
Show (lsl, target, usl);
// This is the critical point
col << Set Property(
"Spec Limits",
{LSL(lsl),Target(target),USL(usl), Show Limits( 1 )}
);
What I have tried in addition:
col << Set Property(
"Spec Limits",
{LSL("lsl"),Target("target"),USL("usl"), Show Limits( 1 )}
);
// OR
col << Set Property(
"Spec Limits",
{LSL(result["num1"]),Target(result["num2"]),USL(result["num3"]), Show Limits( 1 )}
);
// OR
col << Set Property(
"Spec Limits",
{LSL(1),Target(result["num2"]),USL(3), Show Limits( 1 )}
);
And here is the functoon from Ian:
SetSpecLimits = Function( {c, lsl, usl, tar},
cmd = Expr(
c << SetProperty(
"Spec Limits",
{LSL( Expr( lsl ) ), USL( Expr( usl ) ), Target( Expr( tar ) )}
);
Eval( Eval Expr( cmd ) );
);
with the call
SetSpecLimits(Column(dt, name), lsl, usl, tar);