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
ASullivan
Level II

How to replace selected values in a column with JSL

Hi everyone, 

 

I'm looking to replace alternate values in a column in using scripting. I've managed to select the values in the table but I'm struggling to find a way to replace them in just 1 column only. 

 

This is my code so far: 

Names Default To Here (1);
dt << new column ("selection", formula (sequence (1,2,1 ))); dt:selection << delete formula; dt << select where(:1 & :selection !=1);

 

This is the table it creates:

ASullivan_2-1610443139854.png

I want to replace the values highlighted in the first column with 0. Any advice on how to accomplish this would be appreciated. Thanks! 

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to replace selected values in a column with JSL

:Name("1")[ dt << get selected rows ] = 0;
Jim

View solution in original post

7 REPLIES 7
txnelson
Super User

Re: How to replace selected values in a column with JSL

:Name("1")[ dt << get selected rows ] = 0;
Jim
ASullivan
Level II

Re: How to replace selected values in a column with JSL

Thank you @txnelson

 

Also wondering if its possible to then combine the 2 columns into a new column and excluding the 0 values? 

txnelson
Super User

Re: How to replace selected values in a column with JSL

define "combine the 2 columns"
Add them together?
Jim
ASullivan
Level II

Re: How to replace selected values in a column with JSL

By combine I mean have all the data in 1 column and disregard the 0 values, to end up with a table like this:

ASullivan_0-1610452085438.png

 

txnelson
Super User

Re: How to replace selected values in a column with JSL

dt << new column("Final Data", formula(:Area remaining water +
:area remaining exo));
Jim
ASullivan
Level II

Re: How to replace selected values in a column with JSL

Thank you so much! Really helpful!
txnelson
Super User

Re: How to replace selected values in a column with JSL

You need to do some reading. The Discovering JMP and the Using JMP documents. They are found in the JMP Documentation Library under the Help pull down menu.
Jim