我将识别与触发的警报相关的行。 触发警报时调用的处理程序接收有关点的信息,特别是 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);