我將識別與觸發的警報相關的行。 觸發警報時呼叫的處理程序接收有關點的信息,特別是 qc_sample (和 qc_firstRow qc_lastRow)。 如果只有一張圖表,這應該是完美的。 如果我們有單獨的測量值,則範例會識別表格的行。 不幸的是,我有一個 BY 列,它分成許多圖表。 在這種情況下,qc_sample 會引用每個圖表的樣本,這使得很難將相應的行檢索到表中。 有沒有簡單的方法來取得它們?
是的,看起來警報腳本似乎是一個生硬的工具,因為(對我來說…)沒有明顯的方法可以將「qc_sample」的值與「By」變數的層級相關聯,從而與「By」變量的級別相關聯。資料表中的對應行。
但是,根據腳本中發生的其他情況,您也許可以使用「流程篩選」來獲得所需的內容。 下面的腳本應該可以幫助您開始:運行它並檢查日誌和它產生的兩個「詳細」表。
NamesDefaultToHere(1);
// Make some data
dt = NewTable("Alarms",
NewColumn("By", Numeric, Nominal, Formula(RandomInteger(1,2))),
NewColumn("Data", Numeric, Continuous, Formula(RandomNormal(0,1)))
);
dt << addRows(1000);
// Use process screening invisibly to get the details of all alarms (one table for each level of the 'By' variable)
ps = dt << Process Screening( Y(Column(dt, "Data")), By(Column(dt, "By")), Invisible );
dtList = ps << saveDetailsTable;
Report(ps[1]) << closeWindow;
// Control chart with alarm script
cc = dt << Control Chart(
Chart Col( :Data, Individual Measurement, Moving Range ),
By( :By ),
Alarm Script(
Write(
"Out of Control for test ",
qc_test,
" in column ",
qc_col,
" in sample ",
qc_sample,
"\!N"
)
)
);
// Turn on Test 1
cc << Test 1(1);