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.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

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

Run functions when column is not empty

Hi all,

 

I have a function where I needed it running when and only the column is not blank. How can I properly check if the column is not blank and run the function, I tried isMissing() but is not working properly. 

 

Sample function: 

exsqr = Function( {x}, x * x );
exsqr( 5 );

 

So it would look like something like this:

exsqr0; //function1

if (isMissing(Column1),  //if Column1 has values, it should run the function, else, skip this function and proceed to function3

exsqr); //function2

exsqr1; //function3

1 REPLY 1
jthi
Super User

Re: Run functions when column is not empty

You could use Col N Missing in combination with N Rows or Col Number to check if there are anything else besides missing values. Below are some ideas:

Names Default To Here(1);

dt = New Table("Untitled",
	Add Rows(3),
	New Column("Column 1", Numeric, "Continuous", Format("Best", 12), Set Values([., ., .])),
	New Column("Column 2", Numeric, "Continuous", Format("Best", 12), Set Values([1, ., 3]))
);

Show(Col N Missing(:Column 1));
Show(Col N Missing(:Column 2));
If(N Rows(dt) - Col N Missing(:Column 1) > 0,
	Show(:Column 1 << get values);
);

Show(Col Number(:Column 1));
Show(Col Number(:Column 2));
If(Col Number(:Column 2) >= 0,
	Show(:Column 2 << get values);
);
-Jarmo

Recommended Articles