cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
cnattrass
Level II

How to reference a column with complex name in an expression

Beginner JSL scripter here...

I want to create a script that will delete any rows that have missing data within any column. Right now if I rename the column(s) it will work like this:

 

clean_dt << selectWhere(IsMissing(:THK)) << deleteRows ;

 

The problem is, I want this script to be dynamic and be able to handle any name for any column that I give it and reference it by column number for example. Lets say the column name is complex like this

Step::Measurement::Data::THK:Raw (Mean)

 

I dont want to have to rename my columns everytime... I've tried several iterations of things that I think "should" work, but they dont such as

clean_dt << selectWhere(IsMissing(Column(8))) << deleteRows ;

OR

clean_dt << selectWhere(IsMissing(:Step::Data::THK:Raw (Mean))) << deleteRows ; (column name is too complex with special characters)

 

Each time it errors with this message

argument should be numeric{1} in access or evaluation of 'Is Missing' , Is Missing/*###*/(Column( 8 ))

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to reference a column with complex name in an expression

When using the Select Where message, the criteria needs to be based on the current row as JMP will look at each row to see if the row meets the criteria.

Because the Column function actually returns a reference to the entire column, when you use the Column function in your Select Where message, you need to include a subscript to the current row. This can be done by subscripting [Row()] or just [] for short. See below.

 

dt << Select where( Is Missing( Column( 8 )[] ) );

When you want to use a column name with special characters, you can use the Name parser with a string of the column name. If this string needs to be a variable, you would need to use the Column function instead.

dt << Select Where( Is Missing( :Name( "Step::Data::THK:Raw (Mean)" ) ) );

OR

str = "Step::Data::THK:Raw (Mean)";
dt << Select Where( Is Missing( Column( str )[] ) );

 

Justin

View solution in original post

2 REPLIES 2

Re: How to reference a column with complex name in an expression

When using the Select Where message, the criteria needs to be based on the current row as JMP will look at each row to see if the row meets the criteria.

Because the Column function actually returns a reference to the entire column, when you use the Column function in your Select Where message, you need to include a subscript to the current row. This can be done by subscripting [Row()] or just [] for short. See below.

 

dt << Select where( Is Missing( Column( 8 )[] ) );

When you want to use a column name with special characters, you can use the Name parser with a string of the column name. If this string needs to be a variable, you would need to use the Column function instead.

dt << Select Where( Is Missing( :Name( "Step::Data::THK:Raw (Mean)" ) ) );

OR

str = "Step::Data::THK:Raw (Mean)";
dt << Select Where( Is Missing( Column( str )[] ) );

 

Justin
cnattrass
Level II

Re: How to reference a column with complex name in an expression

Thanks, this worked! From here it should be easy to pass the expression in a loop using i as column index