<?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 Add Contents of script file as New Script to data table in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Add-Contents-of-script-file-as-New-Script-to-data-table/m-p/578337#M78578</link>
    <description>&lt;P&gt;I have a saved jmp script.&amp;nbsp; Let's call it &lt;STRONG&gt;my_graph.jsl&lt;/STRONG&gt;.&amp;nbsp; I want to take that script and add it to my current data table as a New Script().&amp;nbsp; I know that&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; New Script(scriptname, code)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;will add a new script to the data table.&amp;nbsp; But it's not clear to me how to get the contents of &lt;STRONG&gt;my_graph.jsl&lt;/STRONG&gt; and dump it in there.&amp;nbsp; I've tried playing around with &lt;STRONG&gt;Load Text File()&lt;/STRONG&gt; but then I'm not sure what to do with that.&amp;nbsp; I imagine the solution will involve some combination of &lt;STRONG&gt;Eval/Expr/Eval Expr&lt;/STRONG&gt; but honestly I've never wrapped my head around the order of those that make sense :\&lt;/img&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 16:04:02 GMT</pubDate>
    <dc:creator>klk</dc:creator>
    <dc:date>2023-06-09T16:04:02Z</dc:date>
    <item>
      <title>Add Contents of script file as New Script to data table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-Contents-of-script-file-as-New-Script-to-data-table/m-p/578337#M78578</link>
      <description>&lt;P&gt;I have a saved jmp script.&amp;nbsp; Let's call it &lt;STRONG&gt;my_graph.jsl&lt;/STRONG&gt;.&amp;nbsp; I want to take that script and add it to my current data table as a New Script().&amp;nbsp; I know that&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; New Script(scriptname, code)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;will add a new script to the data table.&amp;nbsp; But it's not clear to me how to get the contents of &lt;STRONG&gt;my_graph.jsl&lt;/STRONG&gt; and dump it in there.&amp;nbsp; I've tried playing around with &lt;STRONG&gt;Load Text File()&lt;/STRONG&gt; but then I'm not sure what to do with that.&amp;nbsp; I imagine the solution will involve some combination of &lt;STRONG&gt;Eval/Expr/Eval Expr&lt;/STRONG&gt; but honestly I've never wrapped my head around the order of those that make sense :\&lt;/img&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 16:04:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-Contents-of-script-file-as-New-Script-to-data-table/m-p/578337#M78578</guid>
      <dc:creator>klk</dc:creator>
      <dc:date>2023-06-09T16:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Add Contents of script file as New Script to data table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-Contents-of-script-file-as-New-Script-to-data-table/m-p/578402#M78579</link>
      <description>&lt;P&gt;Yep, that's a twisty one&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;maybe something like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;obj=open("/Users/bywing/Byron Wingerd/Examples/eraseme.jsl");
stuff=obj&amp;lt;&amp;lt;get text;

dt=new table("Target");
ex=expr(dt&amp;lt;&amp;lt; new script("Stuffing", "XX" ));
substitute into( ex, "XX", parse(nameexpr(stuff)));
eval(ex);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Dec 2022 04:26:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-Contents-of-script-file-as-New-Script-to-data-table/m-p/578402#M78579</guid>
      <dc:creator>Byron_JMP</dc:creator>
      <dc:date>2022-12-07T04:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Add Contents of script file as New Script to data table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-Contents-of-script-file-as-New-Script-to-data-table/m-p/578407#M78580</link>
      <description>&lt;P&gt;Here is one more option using Include(, &amp;lt;&amp;lt; Parse Only)&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);

script_path = "$DOWNLOADS/table_script.jsl";

txt = "Graph Builder(
	Size(525, 454),
	Show Control Panel(0),
	Variables(X(:weight), Y(:height), Color(:sex)),
	Elements(Points(X, Y, Legend(5)))
);";

Save Text File(script_path, txt);
txt = "";


dt = Open("$SAMPLE_DATA/Big Class.jmp");
Eval(EvalExpr(
	dt &amp;lt;&amp;lt; New Script("Plot Graph", Expr(Include(script_path, &amp;lt;&amp;lt; Parse Only)))
));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Some links regarding eval/eval expr and so on&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;A href="https://community.jmp.com/t5/JSL-Cookbook/Insert-one-expression-into-another-using-Eval-Insert-Eval-Expr/ta-p/48998" target="_blank"&gt;https://community.jmp.com/t5/JSL-Cookbook/Insert-one-expression-into-another-using-Eval-Insert-Eval-Expr/ta-p/48998&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://community.jmp.com/t5/JMPer-Cable/Expression-Handling-Functions-Part-I-Unraveling-the-Expr/ba-p/28963" target="_blank"&gt;https://community.jmp.com/t5/JMPer-Cable/Expression-Handling-Functions-Part-I-Unraveling-the-Expr/ba-p/28963&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://community.jmp.com/t5/Discussions/Can-you-construct-this-without-writing-expression-as-a-string/td-p/369323" target="_blank"&gt;https://community.jmp.com/t5/Discussions/Can-you-construct-this-without-writing-expression-as-a-string/td-p/369323&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Wed, 07 Dec 2022 05:48:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-Contents-of-script-file-as-New-Script-to-data-table/m-p/578407#M78580</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-12-07T05:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: Add Contents of script file as New Script to data table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-Contents-of-script-file-as-New-Script-to-data-table/m-p/578514#M78591</link>
      <description>&lt;P&gt;"&amp;lt;&amp;lt;Parse Only" &amp;nbsp;Nice!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 14:33:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-Contents-of-script-file-as-New-Script-to-data-table/m-p/578514#M78591</guid>
      <dc:creator>Byron_JMP</dc:creator>
      <dc:date>2022-12-07T14:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: Add Contents of script file as New Script to data table</title>
      <link>https://community.jmp.com/t5/Discussions/Add-Contents-of-script-file-as-New-Script-to-data-table/m-p/578984#M78636</link>
      <description>&lt;P&gt;This is perfect, thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 17:32:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Add-Contents-of-script-file-as-New-Script-to-data-table/m-p/578984#M78636</guid>
      <dc:creator>klk</dc:creator>
      <dc:date>2022-12-08T17:32:08Z</dc:date>
    </item>
  </channel>
</rss>

