Choose Language Hide Translation Bar
Highlighted
Yngeinstn
Community Trekker

FInal Yield Table Problem

Mr. txnelson was kind enough to share with me a great script that assigns pass/fail to columns and then ultimately a final Pass/Fail based on the entire row. I would like to that final column into sub columns and while i know how it can be done conceptually, i can't figure out the correct syntax..

 

This piece of code finds the minimum of ALL columns however i would like to add subsets

Eval( Parse( "dt2 << New Column( \!"Row Pass/Fail\!", Formula( If( Min(" || foundCols || " ) == 1, 1, 0 ) )" ) );

 

Columns:
Row Pass/Fail

Test_1 Pass/Fail

Test_2 Pass/Fail

Test_3a Pass/Fail

Test_3b Pass/Fail

Test_3c Pass/Fail

Test_3d Pass/Fail

Test_3e Pass/Fail

Test_4_State_1 Pass/Fail

Test_4_State_3 Pass/Fail

Test_4_State_4 Pass/Fail

 

 

	colList = dt2 << Get Column Names( numeric, string );
	
	foundCols = "";
	
	For( i = 1, i <= N Items( colList ), i++,
	
		Spec = Column( dt2, colList[i] ) << Get Property( "Spec Limits" );
		
		dt2 << Clear Select;
		
		If( Is Empty( Spec ) == 0,
		
			dt2 << New Column( (Column( dt2, colList[i] ) << Get Name) || " Pass/Fail" );
			
			If( Is Missing( Try( Spec["LSL"], . ) ) == 0,
			
				dt2 << Select Where( As Column( dt2, colList[i] ) < Spec["LSL"] );
				
				Try( Column( dt2, N Cols( dt2 ) )[dt2 << get selected rows] = 0 );
			);
			
			If( Is Missing( Try( Spec["USL"], . ) ) == 0,
			
				dt2 << Select Where( As Column( dt2, colList[i] ) > Spec["USL"], Current Selection( "Extend" ) );
				
				Try( Column( dt2, N Cols( dt2 ) )[dt2 << Get Selected Rows] = 0 );
			);
			
			dt2 << invert row selection;
			
			Try( Column( dt2, N Cols( dt2 ) )[dt2 << Get Selected Rows] = 1 );
			
			Column( dt2, N Cols( dt2 ) ) << Set Property( "Value Labels", {1 = "Pass", 0 = "Fail"} );
			
			If( foundCols == "",
				foundCols = ":Name(\!"" || (Column( dt2, colList[i] ) << Get Name) || " Pass/Fail\!")",
				foundCols = foundCols || ", " || ":Name(\!"" || (Column( dt2, colList[i] ) << Get Name) || " Pass/Fail\!")"
			);
		);
	);

 

0 Kudos