<?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: Copying all values and column names from one table to another in jsl in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Copying-all-values-and-column-names-from-one-table-to-another-in/m-p/504675#M73637</link>
    <description>&lt;P&gt;Hey jthi, thank you for your prompt reply.&amp;nbsp; Very helpful!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jun 2022 21:17:56 GMT</pubDate>
    <dc:creator>BladeRunner</dc:creator>
    <dc:date>2022-06-09T21:17:56Z</dc:date>
    <item>
      <title>Copying all values and column names from one table to another in jsl</title>
      <link>https://community.jmp.com/t5/Discussions/Copying-all-values-and-column-names-from-one-table-to-another-in/m-p/504615#M73635</link>
      <description>&lt;P&gt;Hello, I am a JSL beginner.&amp;nbsp; I need the code to copy all existing values in one table as well as the column names and paste them into another newly created table.&amp;nbsp; This is probably super-simple, but after browsing the forum and google searching for awhile, I cannot find the exact answer.&amp;nbsp; My source table contains a few columns with pure data and a few columns with formulas involving simple math between the data columns.&amp;nbsp; My code is below.&amp;nbsp; In addition to the cell values and column names, it seems to copy the formulas as well, and I do not need that.&amp;nbsp; I just need the values as I need to remove certain columns from the new table and the presence of functional relationships between the columns (the formulas) does not allow me to do that.&amp;nbsp; Thanks in advance for your help.&amp;nbsp; I am using JMP 14.0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Pick the source file and folder&lt;/P&gt;&lt;P&gt;dt=Open("C:\Test.jmp");&lt;BR /&gt;Wait(1);&lt;/P&gt;&lt;P&gt;// Create a new Data Table&lt;/P&gt;&lt;P&gt;dt1=Eval(dt &amp;lt;&amp;lt; getScript)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:49:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Copying-all-values-and-column-names-from-one-table-to-another-in/m-p/504615#M73635</guid>
      <dc:creator>BladeRunner</dc:creator>
      <dc:date>2023-06-10T23:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: Copying all values and column names from one table to another in jsl</title>
      <link>https://community.jmp.com/t5/Discussions/Copying-all-values-and-column-names-from-one-table-to-another-in/m-p/504654#M73636</link>
      <description>&lt;P&gt;Easiest way is to use subset (this will copy table scripts/variables, so you have to delete them)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt &amp;lt;&amp;lt; New Column("Mult", Numeric, Continuous, Formula(:height * :weight));

dt_new = dt &amp;lt;&amp;lt; Subset(All rows, Copy formula(0),Selected columns only(0));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And to get the script, let JMP script it for you (if JMP16 even easier with Enhanced Log).&lt;/P&gt;
&lt;P&gt;1. Open table&lt;/P&gt;
&lt;P&gt;2. Go to Tables menu and choose subset&lt;/P&gt;
&lt;P&gt;3. Make choices and press ok&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1654807008982.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/43119i8BA2A8DD2463B9A2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1654807008982.png" alt="jthi_0-1654807008982.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;4. In new table open Source table script and get script for subset&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Data Table("Subset of Big Class") &amp;lt;&amp;lt; Subset(All rows, Selected columns only(0))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;From enhanced log:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1654807079105.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/43120i44B9A726C0A076E9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1654807079105.png" alt="jthi_1-1654807079105.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then modify the script to use references instead of Datatable("tablename") and you should have fairly ready script&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2022 20:38:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Copying-all-values-and-column-names-from-one-table-to-another-in/m-p/504654#M73636</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-06-09T20:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Copying all values and column names from one table to another in jsl</title>
      <link>https://community.jmp.com/t5/Discussions/Copying-all-values-and-column-names-from-one-table-to-another-in/m-p/504675#M73637</link>
      <description>&lt;P&gt;Hey jthi, thank you for your prompt reply.&amp;nbsp; Very helpful!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2022 21:17:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Copying-all-values-and-column-names-from-one-table-to-another-in/m-p/504675#M73637</guid>
      <dc:creator>BladeRunner</dc:creator>
      <dc:date>2022-06-09T21:17:56Z</dc:date>
    </item>
  </channel>
</rss>

