BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
antonio-domenic

Community Trekker

Joined:

Feb 19, 2016

Control charts Alarm Script: identify rows into data table

I would identify the rows associated with the triggered alarms. The handler that is called when alarms are triggered receive the information about the points, in particular qc_sample (and qc_firstRow qc_lastRow). This should be perfect if there is just one chart. The sample identify the row of the table if we have individual measurements. Unfortunately, I have a BY column that splits into many charts. In this case the qc_sample refers to the sample of each chart and this make difficult to retrive the corresponding rows into the table. Is there a simple way to get them?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
ian_jmp

Staff

Joined:

Jun 23, 2011

Solution

Re: Control charts Alarm Script: identify rows into data table

Yes, it looks like the alarm script seems to be a blunt instrument in that there's no obvious way (to me . . . ) that the values of 'qc_sample' can be related to the levels of the 'By' variable, and thence to the appropriate row in the data table.

 

But, depending on what else is going on in your script, you might be able to use 'Process Screening' to get what you need. The script below should get you started: Run it and inspect the log and the two 'detail' tables it makes.

 

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);
1 REPLY 1
Highlighted
ian_jmp

Staff

Joined:

Jun 23, 2011

Solution

Re: Control charts Alarm Script: identify rows into data table

Yes, it looks like the alarm script seems to be a blunt instrument in that there's no obvious way (to me . . . ) that the values of 'qc_sample' can be related to the levels of the 'By' variable, and thence to the appropriate row in the data table.

 

But, depending on what else is going on in your script, you might be able to use 'Process Screening' to get what you need. The script below should get you started: Run it and inspect the log and the two 'detail' tables it makes.

 

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);