cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
jevanove
Level I

Using Configuration Columns to Selectively Apply Rules to Control Charts

Hello,

 

I am having an issue applying the apropriate trend rules, or "Tests", to control charts using JSL. My data consists on the results of multiples analyses for all the measures lots of a certain product in the last year. The data I am working with is in a stacked format, and the table has columns which contain control and specification limits, as well as 8 columns for all 8 Tests. In the tests columns, each row will have either a 1 or a 0 to indicate if the rule will apply. I have set up a sample table below in a similar format for reference.

 

Lot IDAnalysisResultLCLUCLRule1Rule3Rule5
AX121018100
AY204200215101
AZ0.80.51111
BX131018100
BY209200215101
BZ0.70.51111
CX151018100
CY205200215101
CZ0.80.51111

 

In this example, there are 3 unique analyses for 3 unique lots. The Result column is unique for each analysis of each lot, but the control limits and trend rules are matched for matching analyses, so for analysis X, only Rule 1 should apply, but for Analysis Z, all 3 rules should apply. I have control charts being plotted using the code below, with minor modifications to column names for the sake of the example:

 

dt << Control Chart(
	Sample Label( :Lot ),
	Group Size( 1 ),
	KSigma( 3 ),
	By( :Analysis ),
	Chart Col( :Result, Levey Jennings( Show Zones( 1 ), Shade Zones( 1 ), Test 1( :Rule1[1] ), Test 3( :Rule3[1] ), Test 5( :Rule5[1] ) ) ),
	SendToReport(
		Dispatch(
			{},
			"Levey Jennings of Result",
			OutlineBox,
			{Set Title("Parameter: "||char(:Analysis))}
		),

The rest of the code is Dispatch commands to add reference lines, adjust the frame size, etc. Those sections of code are not having issues, so I have omitted them for brevity. As shown above, when adding in the "Test 1", "Test 3" and "Test 5" lines to the Levey Jennings command, I attempted to reference the value of the first row from the respective configuration columns. This way, as the script plots the charts by Analysis, the first row will contain the Trend Rule configuration of the current analysis being plotted. However, when I run the script, it just applies all 3 rules, regardless of if they should be applied for that specific parameter. Can someone help explain how I can get JMP to parse the value from the respective configuration columns and determine if a certain rule should be applied to each chart by Analysis?

 

I have previously made this work in a split table, but I did so by using a for loop to create a string with the values concatenated into the string, then using the Parse and Eval commands to execute. I'd really prefer not to use a for loop here if it can be avoided, as this is why I am pulling the data in a stacked format in the first place.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Using Configuration Columns to Selectively Apply Rules to Control Charts

I ran your JSL with 2 modifications

  1. You specified a column called Lot and the actual name is Lot ID
  2. I removed the Send to Report section
Names Default To Here( 1 );
dt = Current Data Table();
dt << Control Chart(
	Sample Label( :Lot ID ),
	Group Size( 1 ),
	KSigma( 3 ),
	By( :Analysis ),
	Chart Col(
		:Result,
		Levey Jennings(
			Show Zones( 1 ),
			Shade Zones( 1 ),
			Test 1( :Rule1[1] ),
			Test 3( :Rule3[1] ),
			Test 5( :Rule5[1] )
		)
	);

The code ran and produced the following output

txnelson_0-1732158709087.png

To verify that the tests specified were properly handled, I saved the script from the Control Chart output


Control Chart(
	SendToByGroup( {:Analysis == "X"} ),
	Sample Label( :Lot ID ),
	KSigma( 3 ),
	SendToByGroup(
		{:Analysis == "X"},
		Chart Col(
			:Result,
			Levey Jennings( Show Zones( 1 ), Shade Zones( 1 ), Test 1( 1 ) )
		)
	),
	SendToByGroup(
		{:Analysis == "Y"},
		Chart Col(
			:Result,
			Levey Jennings(
				Show Zones( 1 ),
				Shade Zones( 1 ),
				Test 1( 1 ),
				Test 5( 1 )
			)
		)
	),
	SendToByGroup(
		{:Analysis == "Z"},
		Chart Col(
			:Result,
			Levey Jennings(
				Show Zones( 1 ),
				Shade Zones( 1 ),
				Test 1( 1 ),
				Test 3( 1 ),
				Test 5( 1 )
			)
		)
	),
	By( :Analysis )
);

As can be seen in the generated script, the Control Chart received the information on what tests to run for each Analysis

I ran the code on Windows 11 with JMP 18.1.0

I don't see an issue

Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: Using Configuration Columns to Selectively Apply Rules to Control Charts

I ran your JSL with 2 modifications

  1. You specified a column called Lot and the actual name is Lot ID
  2. I removed the Send to Report section
Names Default To Here( 1 );
dt = Current Data Table();
dt << Control Chart(
	Sample Label( :Lot ID ),
	Group Size( 1 ),
	KSigma( 3 ),
	By( :Analysis ),
	Chart Col(
		:Result,
		Levey Jennings(
			Show Zones( 1 ),
			Shade Zones( 1 ),
			Test 1( :Rule1[1] ),
			Test 3( :Rule3[1] ),
			Test 5( :Rule5[1] )
		)
	);

The code ran and produced the following output

txnelson_0-1732158709087.png

To verify that the tests specified were properly handled, I saved the script from the Control Chart output


Control Chart(
	SendToByGroup( {:Analysis == "X"} ),
	Sample Label( :Lot ID ),
	KSigma( 3 ),
	SendToByGroup(
		{:Analysis == "X"},
		Chart Col(
			:Result,
			Levey Jennings( Show Zones( 1 ), Shade Zones( 1 ), Test 1( 1 ) )
		)
	),
	SendToByGroup(
		{:Analysis == "Y"},
		Chart Col(
			:Result,
			Levey Jennings(
				Show Zones( 1 ),
				Shade Zones( 1 ),
				Test 1( 1 ),
				Test 5( 1 )
			)
		)
	),
	SendToByGroup(
		{:Analysis == "Z"},
		Chart Col(
			:Result,
			Levey Jennings(
				Show Zones( 1 ),
				Shade Zones( 1 ),
				Test 1( 1 ),
				Test 3( 1 ),
				Test 5( 1 )
			)
		)
	),
	By( :Analysis )
);

As can be seen in the generated script, the Control Chart received the information on what tests to run for each Analysis

I ran the code on Windows 11 with JMP 18.1.0

I don't see an issue

Jim
jevanove
Level I

Re: Using Configuration Columns to Selectively Apply Rules to Control Charts

Okay so I tried to replicate exactly as you had described. This is the script I ran.

 

Names Default to Here( 1 );
dt = Current Data Table();
dt << Control Chart(
	Sample Label( :Lot ID ),
	Group Size( 1 ),
	KSigma( 3 ),
	By( :Analysis ),
	Chart Col( 
		:Result, 
		Levey Jennings( 
			Show Zones( 1 ), 
			Shade Zones( 1 ), 
			Test 1( :Rule1[1] ), 
			Test 3( :Rule3[1] ), 
			Test 5( :Rule5[1] ) 
		)
	)
);

 

But my output defaults to having all three rules active for each analysis. Here is the script for the X analysis, which should only have test 1 applied based on the configuration columns.

 

Control Chart(
	Sample Label( :Lot ID ),
	KSigma( 3 ),
	Chart Col(
		:Result,
		Levey Jennings(
			Show Zones( 1 ),
			Shade Zones( 1 ),
			Test 1( 1 ),
			Test 3( 1 ),
			Test 5( 1 )
		)
	),
	Where( :Analysis == "X" )
);

 

I am running on JMP 17.0.0 on Windows 11, so perhaps this is something that was addressed in one of the updates between our versions. I will see about updating through my IT department before I do any other troubleshooting. Thanks for testing out the code, I'm happy to see the code should work in principle!

txnelson
Super User

Re: Using Configuration Columns to Selectively Apply Rules to Control Charts

I have replicated your findings in JMP 17.  Below is one way to get the results you want by running each of the Analysis levels one at a time

Names Default To Here( 1 );
dt = Current Data Table();
Summarize( dt, byGroup = By( :Analysis ) );
For Each( {level}, byGroup,
	dt << select where( :Analysis == level );
	dtTemp = dt << Subset( selected columns( 0 ), selected rows( 1 ) );
	Eval(
		Eval Expr(
			dtTemp << Control Chart(
				Sample Label( :Lot ID ),
				Group Size( 1 ),
				KSigma( 3 ), 
	//By( :Analysis ),
				Chart Col(
					:Result,
					Levey Jennings(
						Show Zones( 1 ),
						Shade Zones( 1 ),
						Test 1( Expr( dtTemp:Rule1[1] ) ),
						Test 3( Expr( dtTemp:Rule3[1] ) ),
						Test 5( Expr( dtTemp:Rule5[1] ) )
					)
				)
			)
		)
	);
);
Jim
jevanove
Level I

Re: Using Configuration Columns to Selectively Apply Rules to Control Charts

This is similar to how I had achieved this when working with a split table, looping by column number and creating an expression which was eventually parsed into JSL and evaluated. I was just hoping to avoid the use of a For statement when working with the stacked table and utilizing the By and Where functions to separate out by analysis. Ultimately, this JMP17 code is still leagues simpler than what I had developed for split tables. Thanks again for the input! I'll try and incorporate this into my current script until I am able to upgrade to JMP18.