<?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: Copy values from specific columns of an exiting data-table to another data-table while multiplying selected rows by a constant in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Copy-values-from-specific-columns-of-an-exiting-data-table-to/m-p/439736#M68814</link>
    <description>&lt;P&gt;Hi Neo&lt;/P&gt;
&lt;P&gt;My script as annex. Hope it can help you to sovle the issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Nov 2021 03:17:59 GMT</pubDate>
    <dc:creator>frank_wang</dc:creator>
    <dc:date>2021-11-25T03:17:59Z</dc:date>
    <item>
      <title>Copy values from specific columns of an exiting data-table to another data-table while multiplying selected rows by a constant</title>
      <link>https://community.jmp.com/t5/Discussions/Copy-values-from-specific-columns-of-an-exiting-data-table-to/m-p/439716#M68813</link>
      <description>&lt;P&gt;I have been able to do the first part (copy) but I am struggling with the second (multiply) part. Any direction is appricated. My example script is below.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
bcdt = Open( "$SAMPLE_DATA\Big Class.jmp", invisible ); //load a data-table

myNewdt = New Table( "Parameters Table", //create a new data-table
	Add Rows(8),
	New Column( "Parameter" ),
	New Column( "H", Numeric),
	New Column( "W" ),
);

Column(myNewdt, "Parameter")[1] = "A";
Column(myNewdt, "Parameter")[2] = "B";
Column(myNewdt, "Parameter")[3] = "C";
Column(myNewdt, "Parameter")[4] = "D";
Column(myNewdt, "Parameter")[5] = "E";
Column(myNewdt, "Parameter")[6] = "F";
Column(myNewdt, "Parameter")[7] = "G";
Column(myNewdt, "Parameter")[8] ="I";

vals = Column(bcdt, "height")[4::11]; //get the values to be copied. Note data type becomes "character"
//show (vals);

For( i = 1, i &amp;lt;= N Items(Vals), i++,  //copy values 
	:H[i] =  vals[i] 
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The above script copies the values in column "height" of data file &lt;EM&gt;bcdt&lt;/EM&gt; to column "H" of another data file &lt;EM&gt;myNewdt. &lt;/EM&gt;However, I want for e.g. the 9th and 10th row entries in&amp;nbsp;column "height" of&amp;nbsp;&lt;EM&gt;bcdt&lt;/EM&gt;&amp;nbsp; to be multiplied by a constant number, say 0.0001 and pass it on to the same rows (9th &amp;amp; 10th) of column "H" of the other data file &lt;EM&gt;myNewdt. &lt;/EM&gt;The other row values are to be copied unmodified. How to achieve this?&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:40:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Copy-values-from-specific-columns-of-an-exiting-data-table-to/m-p/439716#M68813</guid>
      <dc:creator>Neo</dc:creator>
      <dc:date>2023-06-10T23:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: Copy values from specific columns of an exiting data-table to another data-table while multiplying selected rows by a constant</title>
      <link>https://community.jmp.com/t5/Discussions/Copy-values-from-specific-columns-of-an-exiting-data-table-to/m-p/439736#M68814</link>
      <description>&lt;P&gt;Hi Neo&lt;/P&gt;
&lt;P&gt;My script as annex. Hope it can help you to sovle the issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Nov 2021 03:17:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Copy-values-from-specific-columns-of-an-exiting-data-table-to/m-p/439736#M68814</guid>
      <dc:creator>frank_wang</dc:creator>
      <dc:date>2021-11-25T03:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: Copy values from specific columns of an exiting data-table to another data-table while multiplying selected rows by a constant</title>
      <link>https://community.jmp.com/t5/Discussions/Copy-values-from-specific-columns-of-an-exiting-data-table-to/m-p/439737#M68815</link>
      <description>&lt;P&gt;Here is the way I would handle this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
bcdt = Open( "$SAMPLE_DATA\Big Class.jmp", invisible ); //load a data-table

myNewdt = New Table( "Parameters Table", //create a new data-table
	Add Rows(8),
	New Column( "Parameter" ),
	New Column( "H", Numeric),
	New Column( "W" ),
);

Column(myNewdt, "Parameter")[1] = "A";
Column(myNewdt, "Parameter")[2] = "B";
Column(myNewdt, "Parameter")[3] = "C";
Column(myNewdt, "Parameter")[4] = "D";
Column(myNewdt, "Parameter")[5] = "E";
Column(myNewdt, "Parameter")[6] = "F";
Column(myNewdt, "Parameter")[7] = "G";
Column(myNewdt, "Parameter")[8] ="I";


bcdt:height[9] = bcdt:height[9] * .0001;
bcdt:height[10] = bcdt:height[10] * .0001;
vals = Column(bcdt, "height")[4::11]; //get the values to be copied. Note data type becomes "character"

myNewdt:H &amp;lt;&amp;lt; set values(vals);

// or

//vals = Column(bcdt, "height")[4::11]; //get the values to be copied. Note data type becomes "character"
//vals[6] = vals[6] * .0001;
//vals[7] = vals[7] * .0001;
//myNewdt:H &amp;lt;&amp;lt; set values(vals);

// or

//vals = Column(bcdt, "height")[4::11]; //get the values to be copied. Note data type becomes "character"
//myNewdt:H &amp;lt;&amp;lt; set values(vals);
//myNewdt:height[6] = myNewdt:height[6] * .0001;
//myNewdt:height[7] = myNewdt:height[7] * .0001;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Nov 2021 03:37:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Copy-values-from-specific-columns-of-an-exiting-data-table-to/m-p/439737#M68815</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-11-25T03:37:37Z</dc:date>
    </item>
  </channel>
</rss>

