<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Update column with values when another columns contains specific value in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/45387#M25943</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&amp;nbsp; 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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have attached a screenshot of my sample data. Any help would be appreciated. Thanks in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JMP.JPG" style="width: 321px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/7846i42A812F38D49E4DF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JMP.JPG" alt="JMP.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Oct 2017 16:30:44 GMT</pubDate>
    <dc:creator>Rini_Kar</dc:creator>
    <dc:date>2017-10-03T16:30:44Z</dc:date>
    <item>
      <title>Update column with values when another columns contains specific value</title>
      <link>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/45387#M25943</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&amp;nbsp; 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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have attached a screenshot of my sample data. Any help would be appreciated. Thanks in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JMP.JPG" style="width: 321px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/7846i42A812F38D49E4DF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JMP.JPG" alt="JMP.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 16:30:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/45387#M25943</guid>
      <dc:creator>Rini_Kar</dc:creator>
      <dc:date>2017-10-03T16:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: Update column with values when another columns contains specific value</title>
      <link>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/45394#M25946</link>
      <description>&lt;P&gt;You could use a formula in a new column&amp;nbsp;like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( Is Missing( :Mailing Country ) &amp;amp; Contains( {"AL","AZ"}, :Mailing State ), "USA" )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you don't want a new column, then you could run this script to replace the missing values in the existing column:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For Each Row(
	:Mailing Country = If( Is Missing( :Mailing Country ) &amp;amp; Contains( {"AL","AZ"}, :Mailing State ), "USA" );
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You would have to expand the list in either case to include the two-letter code for every state before using.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 15:16:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/45394#M25946</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2017-10-03T15:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Update column with values when another columns contains specific value</title>
      <link>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/45398#M25949</link>
      <description>&lt;P&gt;Hi Mark,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your solution.&lt;/P&gt;
&lt;P&gt;However, I notice that when I run your script, the rows without the value gets updated with "USA" whereas the rows with value present before, disappears after running the script.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have attached a screenshot of both before and after running the script. Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Before script" style="width: 311px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/7847iC1AEECDAEAEACBD5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Before_script.JPG" alt="Before script" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Before script&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="After script" style="width: 288px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/7848i78556BB38C1C51A7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="After_script.JPG" alt="After script" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;After script&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 16:31:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/45398#M25949</guid>
      <dc:creator>Rini_Kar</dc:creator>
      <dc:date>2017-10-03T16:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Update column with values when another columns contains specific value</title>
      <link>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/45405#M25953</link>
      <description>&lt;P&gt;Here is one solution taking a little liberty with Mark's script&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For Each Row(
     temp=:Mailing Country;
	:Mailing Country = If( Is Missing( :Mailing Country ) &amp;amp; Contains( {"AL","AZ"}, :Mailing State ), "USA" ,temp);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Oct 2017 16:58:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/45405#M25953</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-10-03T16:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Update column with values when another columns contains specific value</title>
      <link>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/45406#M25954</link>
      <description>&lt;P&gt;Thanks Jim. It worked perfectly.&lt;/P&gt;&lt;P&gt;Thanks Mark for your script.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 17:06:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/45406#M25954</guid>
      <dc:creator>Rini_Kar</dc:creator>
      <dc:date>2017-10-03T17:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: Update column with values when another columns contains specific value</title>
      <link>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/107050#M39087</link>
      <description>&lt;P&gt;Really helpful.! It worked for my usecase too.! Thanks a lot.!&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Here is one solution taking a little liberty with Mark's script&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For Each Row(
     temp=:Mailing Country;
	:Mailing Country = If( Is Missing( :Mailing Country ) &amp;amp; Contains( {"AL","AZ"}, :Mailing State ), "USA" ,temp);
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jan 2019 09:38:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/107050#M39087</guid>
      <dc:creator>Pavithra</dc:creator>
      <dc:date>2019-01-18T09:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: Update column with values when another columns contains specific value</title>
      <link>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/217997#M43582</link>
      <description>&lt;P&gt;I have a simlar iussue. I have IDs and dates that should be identifical but in different columns because of missing values.&lt;/P&gt;&lt;P&gt;How can i apply this to replace only rows with missing values for 6 columns with values from different set of 6 columns?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2019 19:19:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/217997#M43582</guid>
      <dc:creator>theseventhhill</dc:creator>
      <dc:date>2019-07-18T19:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: Update column with values when another columns contains specific value</title>
      <link>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/218076#M43603</link>
      <description>&lt;P&gt;So, if the value in column A is missing, you want the value in column A2 to assigned to column A?&amp;nbsp;&amp;nbsp; And the same for 5 other columns?&lt;/P&gt;
&lt;P&gt;If that is what you are asking, here is how you would do it for column A, and you would repeat for the other 5 columns&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For Each Row(
     If( IsMissing(:A), :A = :A2);
     If( IsMissing(:B), :B = :B2);




);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Jul 2019 01:53:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/218076#M43603</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-07-19T01:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: Update column with values when another columns contains specific value</title>
      <link>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/218077#M43604</link>
      <description>&lt;P&gt;Thanks txnelson.&lt;/P&gt;&lt;P&gt;On a related note, if it is a date entry that is missing, am I bettetr of converting the column to character and then running the script and also, does the "." dot that shows up in missing columns interpreted as missing in the Ismissing() or should it be just blank?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 02:08:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/218077#M43604</guid>
      <dc:creator>theseventhhill</dc:creator>
      <dc:date>2019-07-19T02:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: Update column with values when another columns contains specific value</title>
      <link>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/218078#M43605</link>
      <description>&lt;OL&gt;
&lt;LI&gt;Do not convert the date value to character.&lt;/LI&gt;
&lt;LI&gt;In numeric columns(which a date column is) the "." indicates the value is misssing.&lt;/LI&gt;
&lt;LI&gt;You need to do some reading.&amp;nbsp; The Books "Using JMP" and "Scripting Guide" are a must read.&amp;nbsp; You can find them under the Help pull down menu&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Help==&amp;gt;Books==&amp;gt;Using JMP&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Help==&amp;gt;Books==&amp;gt;Scripting Guide&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 02:16:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/218078#M43605</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-07-19T02:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: Update column with values when another columns contains specific value</title>
      <link>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/267563#M52092</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For Each Row(
        temp = :Vendor;
        :Vendor = If( :Label == "MnDOT Est.", "MnDOT", temp);
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 May 2020 22:03:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/267563#M52092</guid>
      <dc:creator>ACraig</dc:creator>
      <dc:date>2020-05-18T22:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: Update column with values when another columns contains specific value</title>
      <link>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/267570#M52096</link>
      <description>This code needs to be run as a separate script, not as a formula.</description>
      <pubDate>Mon, 18 May 2020 22:24:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Update-column-with-values-when-another-columns-contains-specific/m-p/267570#M52096</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-05-18T22:24:22Z</dc:date>
    </item>
  </channel>
</rss>

