cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

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