cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
chandankishor66
Level III

conditional match with two columns

Hi JMP users

How to write a script to print a value from column:EtOH % form maximum index of : fermentation Age .

For example: if the maximum fermentation Age for Batch 03-05-2022 is 68 then the EtOH % value (13.45) should be picked and printed to the output column.

chandankishor66_0-1685763069997.png

Attached a JMP table here.

Looking forward for your suggestion

Regards

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: conditional match with two columns

Here are 2 similar approaches to solve your issue.

Names Default To Here( 1 );
dt = Current Data Table();
dt << New Column( "Output 2",
	formula(
		theMax = Col Maximum( :EtOH %, :Batch );
		If( theMax == :EtOH %,
			:EtOH %,
			.
		);
	)
);
Names Default To Here( 1 );
dt = Current Data Table();
dt << New Column( "Output 3" );
for each row(
	theMax = Col Maximum( :EtOH %, :Batch );
		If( theMax == :EtOH %,
			:Output3 = :EtOH %,
			:Output3 = .
		);
);
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: conditional match with two columns

Here are 2 similar approaches to solve your issue.

Names Default To Here( 1 );
dt = Current Data Table();
dt << New Column( "Output 2",
	formula(
		theMax = Col Maximum( :EtOH %, :Batch );
		If( theMax == :EtOH %,
			:EtOH %,
			.
		);
	)
);
Names Default To Here( 1 );
dt = Current Data Table();
dt << New Column( "Output 3" );
for each row(
	theMax = Col Maximum( :EtOH %, :Batch );
		If( theMax == :EtOH %,
			:Output3 = :EtOH %,
			:Output3 = .
		);
);
Jim
chandankishor66
Level III

Re: conditional match with two columns

Thank you, Jim.

Recommended Articles