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
hogi
Level XIII

dt: image - missing?

What is the correct way to check if an image in a data table is missing?

... and why is there a difference between the column formula and the JSL question

is missing(:pet[5])

 

Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" );
dt[[4],"pet"]=.;

New Column( "is missing",Formula( Is Missing( :pet ) ));

New Column( "is empty",	Formula( Is Empty( :pet ) ));

New Column( "is number",Formula( Is Number( :pet ) ));

New Column( "is expr",Formula( Is expr( :pet ) ));

write("is missing:");
Show(is missing(:pet[4]));
Try(Show(is missing(:pet[5])), Print("is missing: error with existing image"));

write("\!n\!nis empty");
Show(is empty(:pet[4]));
Show(is empty(:pet[5]));

write("\!n\!nis number");
Show(is number(:pet[4]));
Show(is number(:pet[5]));

write("\!n\!nis expr");
Show(is expr(:pet[4]));
Show(is expr(:pet[5]));
3 REPLIES 3
Craige_Hales
Super User

Re: dt: image - missing?

I find the isMissing() function hard to use. It does not do what I want it to do when its argument is not a number, or maybe a string. Try this:

 

is number(:pet[5]) & is missing(:pet[5])

 

 

 

Craige
Craige_Hales
Super User

Re: dt: image - missing?

And a better answer for the actual question:

New Column( "type",Formula( type( :pet ) ));
type(pet[5])

The type in your example is either "Picture" or "Number".

 

And the other question: The column formula is likely coming up with a string value for the expression. You can use isMissing on a string. You can make the JSL behave the same way, like this:

row()=5;ismissing(:pet)
Craige
jthi
Super User

Re: dt: image - missing?

It can be a mess in JMP to check if objects are empty, missing, null, none, have no items and you will very quickly end in a situation which requires multiple checks to avoid different types of errors. I have created wish list item to have some sort of universal type of function Is None? to check if objects/variables/... are empty/missing

Add function which can be universally used to check if object/variable is empty/missing 

-Jarmo

Recommended Articles