Hi,
I tried to write a jsl script for reading in spec limits from a table to columns in another data table, based on discussions in this community. Pasted below is the script, and the corresponding data and spec limits tables are attached.
I am not sure what I am doing wrong, but when I check the column properties of the data table after running the script, the Spec Limits fields are still blank. Can someone please let me know what I am doing wrong? Thanks in advance.
Names Default To Here( 1 );
dt = Open("test1.jmp");
dt1 = Open("test1_spec.csv");
dt << current data table ();
x = dt << Get Column Names(string);
y = dt1 << Get Column Names(string);
ncols = N Items (x);
for (i=1, i<=ncols, i++,
v = Column(i) << Get Name;
z = (Loc(y,v)) [1];
dt1 << current data table();
uLimit = Column(z)[1];
lLimit = Column(z)[2];
tLimit = Column(z)[3];
dt << current data table ();
Eval(
Eval Expr(
Column(dt,char(x[i])) << Set Property(
"Spec Limits",
{LSL( Expr( lLimit ) ), USL( Expr( uLimit ) ), Target( Expr( tLimit ) ),
Show Limits( 1 )}
)
)
)
);
test_spec (spec limits table):
Description | a | c | d |
USL | 11 | 25 | 42 |
LSL | 0 | 1 | 2.5 |
TT | 5 | 11 | 23 |
test1 (data table):
a | b | c | d |
1 | 3 | 2 | 4 |
2 | 6 | 4 | 8 |
3 | 9 | 6 | 12 |
4 | 12 | 8 | 16 |
5 | 15 | 10 | 20 |
6 | 18 | 12 | 24 |
7 | 21 | 14 | 28 |
8 | 24 | 16 | 32 |
9 | 27 | 18 | 36 |
10 | 30 | 20 | 40 |