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

Update column with values when another columns contains specific value

Hi, 

 

I have two columns named 'Mailing country' and 'Mailing state'. Some of the rows under Mailing country particularly for USA does not contain any value.  I would like to update Mailing country column with value 'USA' when Mailing state contains values corresponding to various state code in the US. I have close to 250,000 rows, so manually update is not possible. I am new to JMP and scripting and I cannot figure out a way to solve this issue.

 

I have attached a screenshot of my sample data. Any help would be appreciated. Thanks in advance.

 JMP.JPG

11 REPLIES 11
ACraig
Level I

Re: Update column with values when another columns contains specific value

Hello,

This might be a silly question but when using this code do you use it by editing the formula of the column? I did it as a formula like this since I am not doing it based off of a missing value. I am trying to update my column Vendor so that when the column Label equals "MnDOT Est." the vendor equals "MnDOT". But it gives me a Column Vendor Formula Interrupted error with an Illegal Reference thing. It changes the ones to MnDOT but it just deletes all the others. I hope that makes sense.

  

For Each Row(
        temp = :Vendor;
        :Vendor = If( :Label == "MnDOT Est.", "MnDOT", temp);
);
txnelson
Super User

Re: Update column with values when another columns contains specific value

This code needs to be run as a separate script, not as a formula.
Jim