cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to use Accelerated Life Testing (ALT) to evaluate reliability. Register for June 5 webinar, 2pm US Eastern Time.

Discussions

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

If select where does not find value then do x else continue with rest of script

Hello and Happy Friday,

 

I am trying to find a way around this one. I have a part in my script where it uses the following below. The issue I have is when it does not find the value ABC in Column1. Basically, I want it to where it runs the code below but if it does not find ABC, then I want it to save a blank table (csv) and stop running the rest of the code. If it does find ABC , then I want it to continue with the rest of the code. Any help will be appreciated.

 

 

Line 1: dt << select where( :Column1 =="ABC" ););
Line 2: dt2=dt << Subset( Output Table( "ABC" ), Selected Rows( 1 ) ););

 

 

1 REPLY 1
txnelson
Super User

Re: If select where does not find value then do x else continue with rest of script

Here is a simple example script that should do what you want

dt << select where( :Column1 =="ABC" );
If( nrows(dt << get selected rows) == 0,
	dtx = new table("no rows");
	dtx << save("...........csv");
	stop();
);

dt2=dt << Subset( Output Table( "ABC" ), Selected Rows( 1 ) );
Jim

Recommended Articles