cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

Add final test result column with one conditional exception.

How can I add final test result column with one exception mention below. 

ConfidenceOwl94_1-1740429891613.png

I apologize for asking same type of question over and over. 

Thanks you

2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: Add final test result column with one conditional exception.

Here is the formula I came up with.  Make sure you study it, and understand it.  If you have questions about it, please get back to the Community for clarification.

If( Col Max( Col Sum( :Result == "Pass", :SN, :Run ), :SN ) == Col Number( 1, :SN, :Run ),
	val = "Pass",
	val = :Result[Col Min( If( :Result != "Pass" & :Final test check == 1, Row(), . ), :SN )];
	If( val == "Bin10" & Col Sum( :Result == "Bin3", :SN ),
		val = "Bin3"
	);
);
val;

txnelson_0-1740445869956.png

 

Jim

View solution in original post

txnelson
Super User

Re: Add final test result column with one conditional exception.

See if this speeds things up.

This is not a formula, it is a JMP script.

Open a new JMP Script window, and paste the below script into the window.

Open your data table to be processed or if already open, just click on it to make it the current data table.

Go back to the script window, and run the script.

It will create a new column in the current data table.

Names Default To Here( 1 );
dt = Current Data Table();
dt << New Column( "theRow", set each value( Row() ) );
Wait( 0 );
dts = dt << Subset( invisible, By( :SN ), All rows, Selected columns only( 0 ), selected columns( 0 ) );

For Each( {d}, dts,
	d << New Column( "calculated wanted column",
		character,
		formula(
			If( Col Max( Col Sum( :Result == "Pass",  :Run ) ) == Col Number( 1 ),
				val = "Pass",
				val = :Result[Col Min( If( :Result != "Pass" & :Final test check == 1, Row(), . ), :SN )];
				If( val == "Bin10" & Col Sum( :Result == "Bin3" ),
					val = "Bin3"
				);
			);
			val;
		)
	);
	dt << Update(
		With( d ),
		Match Columns( :theRow = :theRow ),
		Replace Columns in Main Table( :calculated wanted column )
	);
	Close( d, nosave );
);
dt << delete columns(theRow);

txnelson_0-1740522247423.png

 

 

 

Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: Add final test result column with one conditional exception.

Here is the formula I came up with.  Make sure you study it, and understand it.  If you have questions about it, please get back to the Community for clarification.

If( Col Max( Col Sum( :Result == "Pass", :SN, :Run ), :SN ) == Col Number( 1, :SN, :Run ),
	val = "Pass",
	val = :Result[Col Min( If( :Result != "Pass" & :Final test check == 1, Row(), . ), :SN )];
	If( val == "Bin10" & Col Sum( :Result == "Bin3", :SN ),
		val = "Bin3"
	);
);
val;

txnelson_0-1740445869956.png

 

Jim

Re: Add final test result column with one conditional exception.

Thanks Jim,

 

This works perfectly fine for small set of data. When I used this on my actual data (4000 rows) it is taking forever to execute. Is there any way to make it faster? 

 

 

txnelson
Super User

Re: Add final test result column with one conditional exception.

See if this speeds things up.

This is not a formula, it is a JMP script.

Open a new JMP Script window, and paste the below script into the window.

Open your data table to be processed or if already open, just click on it to make it the current data table.

Go back to the script window, and run the script.

It will create a new column in the current data table.

Names Default To Here( 1 );
dt = Current Data Table();
dt << New Column( "theRow", set each value( Row() ) );
Wait( 0 );
dts = dt << Subset( invisible, By( :SN ), All rows, Selected columns only( 0 ), selected columns( 0 ) );

For Each( {d}, dts,
	d << New Column( "calculated wanted column",
		character,
		formula(
			If( Col Max( Col Sum( :Result == "Pass",  :Run ) ) == Col Number( 1 ),
				val = "Pass",
				val = :Result[Col Min( If( :Result != "Pass" & :Final test check == 1, Row(), . ), :SN )];
				If( val == "Bin10" & Col Sum( :Result == "Bin3" ),
					val = "Bin3"
				);
			);
			val;
		)
	);
	dt << Update(
		With( d ),
		Match Columns( :theRow = :theRow ),
		Replace Columns in Main Table( :calculated wanted column )
	);
	Close( d, nosave );
);
dt << delete columns(theRow);

txnelson_0-1740522247423.png

 

 

 

Jim

Re: Add final test result column with one conditional exception.

Thanks Jim,

It is much faster. 

Recommended Articles