<?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: Fill data table columns with values from another data table in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Fill-data-table-columns-with-values-from-another-data-table/m-p/443727#M69175</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe the reason the script above doesn't work is because the "&amp;lt;&amp;lt;Set each value" command requires a number as input, rather than a matrix; val1 and val2 are matrices.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One way to solve this is to change the last two lines accordingly:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt2&amp;lt;&amp;lt;New Column( "Result 1", Numeric, Continuous,&amp;lt;&amp;lt;Set each value(val1[1]));

dt2&amp;lt;&amp;lt;New Column( "Result 2", Numeric, Continuous,&amp;lt;&amp;lt;Set each value(val2[1]));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Another way is to use "Set Values" by converting val1 and val2 into 9x1 matrices:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt2&amp;lt;&amp;lt;New Column( "Result 1", Numeric, Continuous,&amp;lt;&amp;lt;Set values(J(nrows(dt2),1,val1)));

dt2&amp;lt;&amp;lt;New Column( "Result 2", Numeric, Continuous,&amp;lt;&amp;lt;Set values(J(nrows(dt2),1,val2)));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Dec 2021 10:51:21 GMT</pubDate>
    <dc:creator>HadleyMyers</dc:creator>
    <dc:date>2021-12-09T10:51:21Z</dc:date>
    <item>
      <title>Fill data table columns with values from another data table</title>
      <link>https://community.jmp.com/t5/Discussions/Fill-data-table-columns-with-values-from-another-data-table/m-p/443668#M69172</link>
      <description>&lt;P&gt;Hi JMP community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a question regarding 2 data tables for which one of the data tables should have rows filled with values of columns from the other data table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here an example:&lt;/P&gt;
&lt;P&gt;I have a data table (Table 1) which contains 2 columns that both have one value. In a second data table (Table 2) I have 2 columns with 9 values each. What I want is to copy the Result 1 and Result 2 column values of Table 1 to all 9 rows of Table 2. Can anyone help me correct this script? I'm using JMP 16.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

dt1 = New Table( "Table 1", 
	Add Rows( 1 ), 
	New Column( "Result 1", Numeric, Continuous, Set values( [3] ) ), 
	New Column( "Result 2", Numeric, Continuous, Set values( [5] ) ), 
);

val1 = dt1:"Result 1"n &amp;lt;&amp;lt; Get values;
val2 = dt1:"Result 2"n &amp;lt;&amp;lt; Get values;

dt2 = New Table( "Table 2" );

dt2 &amp;lt;&amp;lt; New Column( "Test1", Numeric, Continuous, Set values( [1, 1, 1, 1, 1, 1, 1, 1, 1] ) );
dt2 &amp;lt;&amp;lt; New Column( "Test2", Numeric, Continuous, Set values( [2, 2, 2, 2, 2, 2, 2, 2, 2] ) );
dt2 &amp;lt;&amp;lt; New Column( "Result 1", Numeric, Continuous, &amp;lt;&amp;lt;Set each value( val1 ) );
dt2 &amp;lt;&amp;lt; New Column( "Result 2", Numeric, Continuous, &amp;lt;&amp;lt;Set each value( val2 ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:41:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Fill-data-table-columns-with-values-from-another-data-table/m-p/443668#M69172</guid>
      <dc:creator>Pim</dc:creator>
      <dc:date>2023-06-10T23:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Fill data table columns with values from another data table</title>
      <link>https://community.jmp.com/t5/Discussions/Fill-data-table-columns-with-values-from-another-data-table/m-p/443727#M69175</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe the reason the script above doesn't work is because the "&amp;lt;&amp;lt;Set each value" command requires a number as input, rather than a matrix; val1 and val2 are matrices.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One way to solve this is to change the last two lines accordingly:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt2&amp;lt;&amp;lt;New Column( "Result 1", Numeric, Continuous,&amp;lt;&amp;lt;Set each value(val1[1]));

dt2&amp;lt;&amp;lt;New Column( "Result 2", Numeric, Continuous,&amp;lt;&amp;lt;Set each value(val2[1]));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Another way is to use "Set Values" by converting val1 and val2 into 9x1 matrices:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt2&amp;lt;&amp;lt;New Column( "Result 1", Numeric, Continuous,&amp;lt;&amp;lt;Set values(J(nrows(dt2),1,val1)));

dt2&amp;lt;&amp;lt;New Column( "Result 2", Numeric, Continuous,&amp;lt;&amp;lt;Set values(J(nrows(dt2),1,val2)));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 10:51:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Fill-data-table-columns-with-values-from-another-data-table/m-p/443727#M69175</guid>
      <dc:creator>HadleyMyers</dc:creator>
      <dc:date>2021-12-09T10:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: Fill data table columns with values from another data table</title>
      <link>https://community.jmp.com/t5/Discussions/Fill-data-table-columns-with-values-from-another-data-table/m-p/444065#M69192</link>
      <description>&lt;P&gt;Thank you Hadley!&amp;nbsp; Your solution works perfectly!&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2021 10:25:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Fill-data-table-columns-with-values-from-another-data-table/m-p/444065#M69192</guid>
      <dc:creator>Pim</dc:creator>
      <dc:date>2021-12-10T10:25:18Z</dc:date>
    </item>
  </channel>
</rss>

