cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.
  • JMP will suspend normal business operations for our Rest and Recharge Day on Friday, October 2, 2026.
    Regular business hours will resume on Monday, October 5, 2026.

Discussions

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

select where conditions not met

I have a script running everyday to determine what parts have failed.  We had a day where none of the parts failed and since my select where condition was not ("Fail") it grabbed all the passing parts and output them to the next table.  How do I write it so that if no parts fail, the next tables should be blank? 

Example:

Data Table ("Parts")<< select where (:PassOrFail == "Fail");
Data Table ("Parts")<< subset (Output Table ("Fails", selected rows (1),selected columns(0)));

 

Since there were no "Fail" in my PassOrFail Column, the output table "Fails" was just a replica of the original table "Parts"

 

2 REPLIES 2
txnelson
Super User

Re: select where conditions not met

Data Table ("Parts")<< select where (:PassOrFail == "Fail");
If( N Rows( Data Table("Parts") << get selected rows ) > 0,
     Data Table ("Parts")<< subset (Output Table ("Fails", selected rows (1),selected columns(0)));
);
Jim
pmroz
Super User

Re: select where conditions not met

Use get rows where instead of select where:

fail_rows = Data Table( "Parts" ) << get rows where( :PassOrFail == "Fail" );

if (nrows(fail_rows) > 0,
	Data Table( "Parts" ) << subset(rows(fail_rows), selected columns( 0 ),
		Output Table( "Fails")
	);
);

Recommended Articles