cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
hogi
Level XII

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