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
cchueng
Level III

Finding consecutive column and rows

Hello,

Attached is the data table of 2 PARTS namely PART-02 and PART-03. Each part has it's own columns and rows (ColX, RowY). I wish to use JSL to identify the PART which has consecutive columns or rows appearing more than 4. Here PART-02 is the one that has rows appearing more than 4 times consecutively. I want my output to be just a table with PART ID and the result like below. 

cchueng_0-1722704004850.png

cchueng_1-1722704169769.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Finding consecutive column and rows

  1. The use of the Col Moving Average as the check did not work so I changed it to using a Standard Deviation over the 7 rows.
  2. The method I was using to find the row in the dtResults data table was not working.  I had to change to a For() loop to be able to get the exactness required.
  3. I had the logic backwards.....Passing if finding the values in a row, rather than Failing when that happened.
Names Default To Here( 1 );
dt = Current Data Table();

dtResults = dt << summary(
	group( :LotLabel, :WaferLabel ),
	output table( "Results" ),
	Link to Original Data Table( 0 )
);
dtResults << delete columns( :N Rows );
dtResults << New Column( "Results",
	character,
	set each value( "PASS" )
);

For( i = 1, i <= N Rows( dt ), i++,
	If( i >= 7,
		If(
			Std Dev( dt:ColX[i - 6 :: i] ) == 0 |
			Std Dev( dt:RowY[i - 6 :: i] ) == 0,
			dtResults:Results[dtResults <<
			get rows where(
				dtResults:LotLabel == dt:LotLabel[i] & dtResults
				:WaferLabel == dt:WaferLabel[i]
			)] = "FAIL"
		)
	)
);

You need to study the code, don't just cut and paste it into your script.  You need to be learned enough to be able to debug future issues and to generate the fixes.

Jim

View solution in original post

6 REPLIES 6
txnelson
Super User

Re: Finding consecutive column and rows

Here is the JSL that I came up with that creates the new table and populates it as you specified

Names Default To Here( 1 );
dt = Current Data Table();

dtResults = dt <<
summary(
	group( :LotLabel, :WaferLabel ),
	output table( "Results" ),
	Link to Original Data Table( 0 )
);
dtResults << delete columns( :N Rows );
dtResults << New Column( "Results",
	character,
	set each value( "FAIL" )
);

For Each Row(
	dt,
	If( Row() >= 4,
		If(
			Col Moving Average(
				:ColX,
				weighting = 1,
				before = -3,
				after = 0,
				:LotLabel,
				:WaferLabel
			) == :ColX |
			Col Moving Average(
				:RowY,
				weighting = 1,
				before = -3,
				after = 0,
				:LotLabel,
				:WaferLabel
			) == :RowY,
			dtResults:Results[dtResults << get rows where(
				dtResults:LotLabel == dt:LotLabel &
				dtResults:WaferLabel == dt:WaferLabel 
			)]  = "PASS"
		)
	)
);

txnelson_0-1722708023061.png

 

Jim
cchueng
Level III

Re: Finding consecutive column and rows

Hi Jim, in the previous dataset, for PART-01, 02 should be pass. Sorry for the misinformation. Attached is a larger dataset including PART-01,02,03,17. Part-01,02,03 should be Pass and only PART-17 should fail.  It should  be  as below but your script is stating PART02,03 are failing as well.

cchueng_0-1722719709828.png

 

txnelson
Super User

Re: Finding consecutive column and rows

Yes, you need to change the 4 to 7 and the -3 to -6.

The weighting factor provides the ability to set weight of each of the values being average.  The value of 1 indicates to use equal weighting on each value.

Before = sets the number of rows before  the current row to use in the calculation of the moving average.

After = sets the number of rows after the current row to use in the calculation of the moving average.

 

Finally, please use the JSL icon at the top of the Preview when  entering JSL into the discussion.  It really help the readers read and interpret the code.

I have edited your last response, and moved your listed JSL into a JSL display box

Jim
cchueng
Level III

Re: Finding consecutive column and rows

Hi Jim, in the previous dataset, for PART-01, 02 should be pass. Sorry for the misinformation. Attached is a larger dataset including PART-01,02,03,17. Part-01,02,03 should be Pass and only PART-17 should fail.  It should  be  as below but your script is stating PART02,03 are failing as well.

cchueng_0-1722720748520.png

 

txnelson
Super User

Re: Finding consecutive column and rows

  1. The use of the Col Moving Average as the check did not work so I changed it to using a Standard Deviation over the 7 rows.
  2. The method I was using to find the row in the dtResults data table was not working.  I had to change to a For() loop to be able to get the exactness required.
  3. I had the logic backwards.....Passing if finding the values in a row, rather than Failing when that happened.
Names Default To Here( 1 );
dt = Current Data Table();

dtResults = dt << summary(
	group( :LotLabel, :WaferLabel ),
	output table( "Results" ),
	Link to Original Data Table( 0 )
);
dtResults << delete columns( :N Rows );
dtResults << New Column( "Results",
	character,
	set each value( "PASS" )
);

For( i = 1, i <= N Rows( dt ), i++,
	If( i >= 7,
		If(
			Std Dev( dt:ColX[i - 6 :: i] ) == 0 |
			Std Dev( dt:RowY[i - 6 :: i] ) == 0,
			dtResults:Results[dtResults <<
			get rows where(
				dtResults:LotLabel == dt:LotLabel[i] & dtResults
				:WaferLabel == dt:WaferLabel[i]
			)] = "FAIL"
		)
	)
);

You need to study the code, don't just cut and paste it into your script.  You need to be learned enough to be able to debug future issues and to generate the fixes.

Jim
cchueng
Level III

Re: Finding consecutive column and rows

Thanks, Jim. After some adjustments, it worked for me.