cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Use World Cup data to build models, explore spatial relationships, and create informative visualizations in JMP. Register. July 17, 2 pm US Eastern Time.
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

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