<?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: how do I Save variable values to new script in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/how-do-I-Save-variable-values-to-new-script/m-p/343822#M59323</link>
    <description>&lt;P&gt;Slightly different, not necessarily better:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;NamesDefaultToHere(1);

dt = NewTable("Test");

myScript =
Expr(
	a = {1, 2, 3, 4};
	Speak(a);
	);

addScript = 
Expr(
	dt &amp;lt;&amp;lt; NewScript(nTBD, sTBD)
	);

SubstituteInto(
	addScript,
	Expr(nTBD), "My Script",
	Expr(sTBD), EvalExpr(myScript)
	);

addScript;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 22 Dec 2020 16:18:02 GMT</pubDate>
    <dc:creator>ian_jmp</dc:creator>
    <dc:date>2020-12-22T16:18:02Z</dc:date>
    <item>
      <title>how do I Save variable values to new script</title>
      <link>https://community.jmp.com/t5/Discussions/how-do-I-Save-variable-values-to-new-script/m-p/343643#M59306</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to save metadata to a table, so next time I open the file I will be able to use some variables I used when I built the table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand that currently only strings can be saved as metadata to the table.&lt;/P&gt;&lt;P&gt;The other options I tried is to save new script to the table that will include the variables that I need.&lt;/P&gt;&lt;P&gt;the problem is that I don't understand how to use the "Save Script" in a way that will add the value of the variable instead of the variable name.&lt;/P&gt;&lt;P&gt;for example I tried this :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;x = expr (a = [1,2,3]);
dt &amp;lt;&amp;lt; New script ("test",char (x));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;which results in a script with - char(x).&lt;/P&gt;&lt;P&gt;I tried any expr/eval/parse combination I could think of but non of them helped.&lt;/P&gt;&lt;P&gt;I just want the new script "test" to include :&lt;/P&gt;&lt;P&gt;a = [1,2,3]&lt;/P&gt;&lt;P&gt;but when I'm writing the script of course I don't know the actual value of a.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 22:01:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/how-do-I-Save-variable-values-to-new-script/m-p/343643#M59306</guid>
      <dc:creator>Rans</dc:creator>
      <dc:date>2023-06-09T22:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: how do I Save variable values to new script</title>
      <link>https://community.jmp.com/t5/Discussions/how-do-I-Save-variable-values-to-new-script/m-p/343683#M59308</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does this do what you're looking for?:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;x = expr ("a = [1,2,3]");
eval(eval expr(dt &amp;lt;&amp;lt; New script ("test",char (expr(parse(x))))));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Dec 2020 08:23:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/how-do-I-Save-variable-values-to-new-script/m-p/343683#M59308</guid>
      <dc:creator>HadleyMyers</dc:creator>
      <dc:date>2020-12-22T08:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: how do I Save variable values to new script</title>
      <link>https://community.jmp.com/t5/Discussions/how-do-I-Save-variable-values-to-new-script/m-p/343703#M59310</link>
      <description>&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;I missed the option of using "eval (eval expr(".."))"&lt;/P&gt;&lt;P&gt;The way I finally used it was like this &amp;nbsp;-&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;a = {1,2,3};
Eval(Eval Expr(dt &amp;lt;&amp;lt; New script ("test",
a = expr (a);
)));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;this way the new test script now include "a = {1,2,3};", which is what I wanted.&lt;/P&gt;&lt;P&gt;Thanks again.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 09:23:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/how-do-I-Save-variable-values-to-new-script/m-p/343703#M59310</guid>
      <dc:creator>Rans</dc:creator>
      <dc:date>2020-12-22T09:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: how do I Save variable values to new script</title>
      <link>https://community.jmp.com/t5/Discussions/how-do-I-Save-variable-values-to-new-script/m-p/343822#M59323</link>
      <description>&lt;P&gt;Slightly different, not necessarily better:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;NamesDefaultToHere(1);

dt = NewTable("Test");

myScript =
Expr(
	a = {1, 2, 3, 4};
	Speak(a);
	);

addScript = 
Expr(
	dt &amp;lt;&amp;lt; NewScript(nTBD, sTBD)
	);

SubstituteInto(
	addScript,
	Expr(nTBD), "My Script",
	Expr(sTBD), EvalExpr(myScript)
	);

addScript;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Dec 2020 16:18:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/how-do-I-Save-variable-values-to-new-script/m-p/343822#M59323</guid>
      <dc:creator>ian_jmp</dc:creator>
      <dc:date>2020-12-22T16:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: how do I Save variable values to new script</title>
      <link>https://community.jmp.com/t5/Discussions/how-do-I-Save-variable-values-to-new-script/m-p/343942#M59345</link>
      <description>&lt;P&gt;I like to use evalinsert and eval(parse()).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = New Table( "Untitled 8",
	Add Rows( 2 ),
	New Column( "Column 1", Character, "Nominal", Set Values( {"a", "b"} ) )
);
a1 = "a = [1, 2, 3]";
b1 = evalinsert("\[dt &amp;lt;&amp;lt; new script("test", ^a1^)]\");
eval(parse(b1));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Dec 2020 20:25:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/how-do-I-Save-variable-values-to-new-script/m-p/343942#M59345</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2020-12-22T20:25:44Z</dc:date>
    </item>
  </channel>
</rss>

