<?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: saving script to data table issue in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/saving-script-to-data-table-issue/m-p/350972#M60060</link>
    <description>So the question is, where does the script elements come from that you need to put together to build the literal string I called, "theScript".  So where does what you call the "full script" come from?</description>
    <pubDate>Wed, 20 Jan 2021 02:09:09 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2021-01-20T02:09:09Z</dc:date>
    <item>
      <title>saving script to data table issue</title>
      <link>https://community.jmp.com/t5/Discussions/saving-script-to-data-table-issue/m-p/350912#M60054</link>
      <description>&lt;P&gt;HI all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have written a script (a few hundred lines) that 1) &amp;nbsp;opens an existing data table, 2) does a whole bunch of calculations and then 3) spits out a new data table with results from these calculations. Because I am continually improving the script, I want to make sure that I know which exact version of the script was used to create the new output data table and so thought of saving the whole script to the data table. I tried using NewDt&amp;lt;&amp;lt;save script to data table but this will only save as a script the line that created the NewDt, not the full script. Ideally I would like to save not only the script but also the original data table from which the NewDt was created. Any suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards and thanks, Yves&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:25:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/saving-script-to-data-table-issue/m-p/350912#M60054</guid>
      <dc:creator>yvesprairie</dc:creator>
      <dc:date>2023-06-10T23:25:02Z</dc:date>
    </item>
    <item>
      <title>Re: saving script to data table issue</title>
      <link>https://community.jmp.com/t5/Discussions/saving-script-to-data-table-issue/m-p/350931#M60055</link>
      <description>&lt;P&gt;Here is a simple script that will show you one way to do this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

biv = dt &amp;lt;&amp;lt; bivariate( x( :height ), y( :weight ) );
theScript = Char( biv &amp;lt;&amp;lt; get script );

Eval( Parse( "\[dt&amp;lt;&amp;lt;new script("Saved Script",]\" || theScript || ");" ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Jan 2021 23:22:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/saving-script-to-data-table-issue/m-p/350931#M60055</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-01-19T23:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: saving script to data table issue</title>
      <link>https://community.jmp.com/t5/Discussions/saving-script-to-data-table-issue/m-p/350951#M60057</link>
      <description>&lt;P&gt;Thanks Jim but I don't think that it solves my problem. My issue is more like the following:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
m = dt &amp;lt;&amp;lt; Get All Columns As Matrix();

Several lines of matrix algebra with the columns of m producing various vectors y1, y2, y3

dt2=as table(y1, y2, y3);
&lt;/LI-CODE&gt;&lt;P&gt;I want to entire script above to be saved to dt2. Thanks again, Yves&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 01:25:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/saving-script-to-data-table-issue/m-p/350951#M60057</guid>
      <dc:creator>yvesprairie</dc:creator>
      <dc:date>2021-01-20T01:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: saving script to data table issue</title>
      <link>https://community.jmp.com/t5/Discussions/saving-script-to-data-table-issue/m-p/350972#M60060</link>
      <description>So the question is, where does the script elements come from that you need to put together to build the literal string I called, "theScript".  So where does what you call the "full script" come from?</description>
      <pubDate>Wed, 20 Jan 2021 02:09:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/saving-script-to-data-table-issue/m-p/350972#M60060</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-01-20T02:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: saving script to data table issue</title>
      <link>https://community.jmp.com/t5/Discussions/saving-script-to-data-table-issue/m-p/350975#M60063</link>
      <description>&lt;P&gt;That's the problem, the. script doesn't "come" from anywhere, it is simply all the lines I have written contained in my fictitious example. THis is what I can't figure out how to do! Thanks, Yves&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 02:17:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/saving-script-to-data-table-issue/m-p/350975#M60063</guid>
      <dc:creator>yvesprairie</dc:creator>
      <dc:date>2021-01-20T02:17:44Z</dc:date>
    </item>
    <item>
      <title>Re: saving script to data table issue</title>
      <link>https://community.jmp.com/t5/Discussions/saving-script-to-data-table-issue/m-p/350976#M60064</link>
      <description>&lt;P&gt;Here is a simple example of what you will have to do to create such a script.&amp;nbsp; Components that you will not be able to get from JMP, you will have to add into theScript as you build it.&amp;nbsp; Basically, you just concatenate it as you go.&amp;nbsp; Then when done, you add it to the data table.&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 = current data table();

theScript = "\[dt = current data table(); ]\";
If( try( dt:ratio &amp;lt;&amp;lt; get name,"") == "",
	dt&amp;lt;&amp;lt;new column("ratio", formula(:height/:weight))
);
theScript = theScript ||
"\[
	If( try( dt:ratio &amp;lt;&amp;lt; get name,"") == "",
	dt&amp;lt;&amp;lt;new column("ratio", formula(:height/:weight))
	);
]\";


biv = dt &amp;lt;&amp;lt; bivariate( x( :ratio), y(:weight ) );
theScript = theScript || Char( biv &amp;lt;&amp;lt; get script );

Eval( Parse( "\[dt&amp;lt;&amp;lt;new script("Saved Script",]\" || theScript || ");" ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have also used a method where I first build the entire script as a literal string, and then save it as a script.&amp;nbsp; Then I turn around and run the saved script, which then gives the results.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;theScript = "\[
	dt = current data table();
	dt &amp;lt;&amp;lt; bivariate( x(:weight), y(:height));
]\";
Eval( Parse( "\[dt&amp;lt;&amp;lt;new script("Saved Script2",]\" || theScript || ");" ) );
dt &amp;lt;&amp;lt; run script("Saved Script2");&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Jan 2021 02:51:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/saving-script-to-data-table-issue/m-p/350976#M60064</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2021-01-20T02:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: saving script to data table issue</title>
      <link>https://community.jmp.com/t5/Discussions/saving-script-to-data-table-issue/m-p/350978#M60066</link>
      <description>&lt;P&gt;Many thanks I will try that! Your help much appreciated. Yves&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 03:11:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/saving-script-to-data-table-issue/m-p/350978#M60066</guid>
      <dc:creator>yvesprairie</dc:creator>
      <dc:date>2021-01-20T03:11:23Z</dc:date>
    </item>
  </channel>
</rss>

