cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
rmthomas
Level III

How to clean up my Spec Limit Table

Hello Everyone,

 

I am pulling my spec limits from a data table that is  and they have a few issues I have noticed with my data:

Case 1. the LSL and the Target are the same number 

Case 2. The Target and the USL are the same number 

Case 3: If LSL and Target are Zero (0) 

 

is there a JSL solution to get rid of these issues?

 

What I want:

Case 1: Remove the Target  if LSL is the same

Case 2: Remove the Target if the USL is the same 

Case 3: Remove the LSL  if Target is Zero (0)

 

This is an example of what I have.

 

rmthomas_0-1632251086518.png

 

This is what I would like to have

 

rmthomas_1-1632251398065.png

 

 

I have not had any luck trying to get this to work with the JMP Scripting Index. 

 

Any help would be much appreciated.

 

Thanks, 

 

-Ryan 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to clean up my Spec Limit Table

This is fairly simple to script. Below is an example script which should handle the case1 (take note that order does matter with these):

Names Default To Here(1);

dt = New Table("Specs",
	Add Rows(5),
	New Column("Column 1",
		Character,
		"Nominal",
		Set Values({"Part 1", "Part 2", "Part 3", "Part 4", "Part 5"})
	),
	New Column("LSL", Numeric, "Continuous", Format("Best", 12), Set Values([0, 38, 93, 9, 9])),
	New Column("TARGET", Numeric, "Continuous", Format("Best", 12), Set Values([0, 40, 94, 10, 9])),
	New Column("USL",
		Numeric,
		"Continuous",
		Format("Best", 12),
		Set Values([13, 41, 94, 10, 10])
	)
);

//ORDER MATTERS WITH THESE (see case1 vs case3)
//case 1
wait(2); //to help with visualization on what is going on curRows = dt << Get Rows Where(:LSL == :Target); :Target[curRows] = .; //case 2 //case 3

You can use << Get Rows Where(condition) to get the rows you want to modify in a matrix and then use that matrix with data table subscripting to update values.

-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: How to clean up my Spec Limit Table

This is fairly simple to script. Below is an example script which should handle the case1 (take note that order does matter with these):

Names Default To Here(1);

dt = New Table("Specs",
	Add Rows(5),
	New Column("Column 1",
		Character,
		"Nominal",
		Set Values({"Part 1", "Part 2", "Part 3", "Part 4", "Part 5"})
	),
	New Column("LSL", Numeric, "Continuous", Format("Best", 12), Set Values([0, 38, 93, 9, 9])),
	New Column("TARGET", Numeric, "Continuous", Format("Best", 12), Set Values([0, 40, 94, 10, 9])),
	New Column("USL",
		Numeric,
		"Continuous",
		Format("Best", 12),
		Set Values([13, 41, 94, 10, 10])
	)
);

//ORDER MATTERS WITH THESE (see case1 vs case3)
//case 1
wait(2); //to help with visualization on what is going on curRows = dt << Get Rows Where(:LSL == :Target); :Target[curRows] = .; //case 2 //case 3

You can use << Get Rows Where(condition) to get the rows you want to modify in a matrix and then use that matrix with data table subscripting to update values.

-Jarmo