一位客戶詢問如何建立 JSL 腳本來提示其他使用者為每個子集表定義 LSL 和 USL。
我想不妨把腳本發佈到這裡,以便將來有同樣需求的人能夠得到幫助。如果您有任何回饋、疑問或改進建議,請隨時留言。
// Subset data table
// → Data Table( "Product=B" )
dtList = Open("$SAMPLE_DATA/Abrasion.jmp")
<
<SUBSET></SUBSET>
很棒的腳本!為了讓它更通用,你可能需要回答一些額外的問題:
- 您是否總是在所有打開的桌子上使用它,或者用戶是否應該能夠選擇桌子?
- 如何定義要設定規格限值的欄位?表格中的第一列?用戶是否應該能夠選擇它們,或者只是讓用戶將它們設置為所有連續的列?
我還將使用 Names Default To Here(1); 啟動腳本,以避免全域命名空間可能導致的一些問題。
您也可以「讓」客戶使用 JMP 的「管理限值」功能。這樣做的“問題”在於,用戶必須知道點擊“儲存到列屬性”,然後點擊“確定”。
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Abrasion.jmp");
dt <
<SUBSET></SUBSET>
<P>對於“通用”版本,它只需要所有表格</P> <BR /> <BR /> <CODE class=" language-jsl">Names Default To Here(1);
For Each({dt_ref}, Get Data Table List(),
New Window("Manage Limits for " || (dt_ref << get name) || " - :Abrasion" , << modal, dt_ref << Manage Limits(Process Variables(dt_ref << Get Column Names("Continuous"))));
);
我很可能至少會為用戶提供選擇使用哪些表的選項,因此在使用管理限制時它會是這樣的
Names Default To Here(1);
dtlist = Get Data Table List();
dtnames = Transform Each({dtref}, dtlist,
dtref << get name
);
// I don't like using modal windows, but maybe it is fine in this case
nw = New Window("Pick tables to set spec limits to", << modal, << return result,
<< On Validate(
If(N Items(lb_tables << get selected) < 1,
New Window("Warning", << modal,
H List Box(align("center"),
Icon box("Warning"),
Text Box("Select at least one table or cancel"), << Set Window Icon("Warning")
)
);
0;
,
1;
);
),
Lineup Box(N Col(2),
Panel Box("Pick Tables",
lb_tables = Listbox(dtnames)
),
Panel Box("Actions",
Button Box("OK",
user_selections = lb_tables << get selected;
),
Button Box("Cancel")
)
)
);
If(nw["Button"] == 1,
For Each({tablename}, nw["lb_tables"],
dt_ref = Datatable(tablename);
New Window("Manage Limits for " || (dt_ref << get name) || " - :Abrasion" , << modal,
H List Box(align("bottom"),
ml = dt_ref << Manage Limits(Process Variables(dt_ref << Get Column Names("Continuous"))),
Lineup Box(N Col(1),
Button Box("OK",
ml << Save to Column Properties; // could be used to "force save"
),
Button Box("Cancel")
)
)
);
);
);