<?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 Re: Add a new value to rows of an existing column in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Add-a-new-value-to-rows-of-an-existing-column/m-p/51709#M29326</link>
    <description>&lt;P&gt;Hi Jim.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot for your help. The modification worked and got lot simplified.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Joydeep&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Feb 2018 05:01:14 GMT</pubDate>
    <dc:creator>joydeepb83</dc:creator>
    <dc:date>2018-02-21T05:01:14Z</dc:date>
    <item>
      <title>Add a new value to rows of an existing column</title>
      <link>https://community.jmp.com/t5/Discussions/Add-a-new-value-to-rows-of-an-existing-column/m-p/51706#M29323</link>
      <description>&lt;P&gt;Hi, I am new to JSL . I am trying to write a code do achieve the following.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 4 different JMP table. I am comparing each row of column 1 of Table 1 with column 1 of the remaining three table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If any entry/row of Coulmn 1 /table 1 matches with column 1 of Table 2 , It assigns Character say- Group1 to the row in table 1/ Column 4.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Similarly if any row of column 1/tale1 matches with column1 of table 3 and table 4 then it assigns a character say- Group 2 in table 1/column 4.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am successfully creating column 4 and after comparison with table 2.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However I am finiding it difficulty to update the same column 4 with Group2 when I am comparing the rows of table1 /column1 with table 3/column1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anybody please help?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*More specifically, how can I update my existing column with new character string for given condition. as I cant use -new column for that.*&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thansk&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;jodyeep&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 04:04:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-a-new-value-to-rows-of-an-existing-column/m-p/51706#M29323</guid>
      <dc:creator>joydeepb83</dc:creator>
      <dc:date>2018-02-21T04:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: Add a new value to rows of an existing column</title>
      <link>https://community.jmp.com/t5/Discussions/Add-a-new-value-to-rows-of-an-existing-column/m-p/51708#M29325</link>
      <description>&lt;P&gt;Here are a couple of examples that I hope will give you a leg up with the script you are working on&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt1 = New Table( "Table 1", New Column( "Col A", character, values( {"A1", "A2", "A3"} ) ) );
dt2 = New Table( "Table 2", New Column( "Col B", character, values( {"B1", "B2", "B3"} ) ) );
dt3 = New Table( "Table 3", New Column( "Col C", character, values( {"C1", "C2", "C3"} ) ) );

If( dt1:Col A[1] == "A1",
	dt2:Col B[3] = "Group 1"
);

If( dt2[2, 1] == "B2",
	Data Table( "Table 1" ):Col A[2] = "Looking Good"
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Here is a modification of your script that I believe will simplify the code&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);

dt3 = Open( "\\Table 2" );

dt6 = Open( "Table 1" );
dt6 &amp;lt;&amp;lt; New Column( "Group",
	Character)

m = N Rows( dt6 );
n = N Rows( dt3 );

For( i = 1, i &amp;lt;= m, i++,;
	For( j = 1, j &amp;lt;= n, j++,        
		If( Column( dt6, "Core ID" )[i] == (Column( dt3, "PC_ID" )[j]),
			dt6:Group[i] = "Group 1"
		);       
	);   
);               
 
dt6 &amp;lt;&amp;lt; save( "Table1" );
 
 

//Close( dt3, nosave );
//Close( dt6, nosave );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Feb 2018 04:33:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-a-new-value-to-rows-of-an-existing-column/m-p/51708#M29325</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2018-02-21T04:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: Add a new value to rows of an existing column</title>
      <link>https://community.jmp.com/t5/Discussions/Add-a-new-value-to-rows-of-an-existing-column/m-p/51709#M29326</link>
      <description>&lt;P&gt;Hi Jim.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot for your help. The modification worked and got lot simplified.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Joydeep&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 05:01:14 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-a-new-value-to-rows-of-an-existing-column/m-p/51709#M29326</guid>
      <dc:creator>joydeepb83</dc:creator>
      <dc:date>2018-02-21T05:01:14Z</dc:date>
    </item>
  </channel>
</rss>

