<?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 to use the value of my For Each loop to generate new table scripts in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-use-the-value-of-my-For-Each-loop-to-generate-new-table/m-p/533678#M75652</link>
    <description>&lt;P&gt;thank you that is indeed working nicely&lt;/P&gt;</description>
    <pubDate>Mon, 15 Aug 2022 10:41:54 GMT</pubDate>
    <dc:creator>mvanderaa1</dc:creator>
    <dc:date>2022-08-15T10:41:54Z</dc:date>
    <item>
      <title>How to use the value of my For Each loop to generate new table scripts</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-the-value-of-my-For-Each-loop-to-generate-new-table/m-p/533640#M75649</link>
      <description>&lt;P&gt;I am looping over existing data table scripts and creating a duplicate of each script with some alterations.&lt;/P&gt;&lt;P&gt;I want to insert those table script names into the generated table scripts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output I get just inserts the word "script" in my generated table scripts instead of the actual string value in scriptList&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
scriptList = dt &amp;lt;&amp;lt; Get Table Script Names;
For Each({script}, scriptList,
	If ((!Contains(scriptList, "Run "||script)),				
		dt &amp;lt;&amp;lt; New Script("Run "||script,dt=Current DataTable();w=eval(dt &amp;lt;&amp;lt; get table property((script)));w &amp;lt;&amp;lt; set window title((script)));		
	);	
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Jun 2023 23:53:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-the-value-of-my-For-Each-loop-to-generate-new-table/m-p/533640#M75649</guid>
      <dc:creator>mvanderaa1</dc:creator>
      <dc:date>2023-06-10T23:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the value of my For Each loop to generate new table scripts</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-the-value-of-my-For-Each-loop-to-generate-new-table/m-p/533649#M75650</link>
      <description>&lt;P&gt;Some expression handling combined with &lt;LI-MESSAGE title="Insert one expression into another using Eval Insert, Eval Expr, Parse, and Substitute" uid="48998" url="https://community.jmp.com/t5/JSL-Cookbook/Insert-one-expression-into-another-using-Eval-Insert-Eval-Expr/m-p/48998#U48998" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-tkb-thread lia-fa-icon lia-fa-tkb lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt; should work. Here is one example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

For Each({script_name}, dt &amp;lt;&amp;lt; Get Table Script Names,
	If((!Contains(script_name, "Run " || script_name)),
		script_expr = dt &amp;lt;&amp;lt; Get Script(script_name);
		Eval(Substitute(
			Expr(
				dt &amp;lt;&amp;lt; New Script("Run " || _script_name_,
					Local({w},
						w = _new_script_;
						w &amp;lt;&amp;lt; set window title(_script_name_)
					)
				);
			),
			Expr(_script_name_), script_name,
			Expr(_new_script_), Name Expr(script_expr)
		))
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Aug 2022 10:02:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-the-value-of-my-For-Each-loop-to-generate-new-table/m-p/533649#M75650</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-08-15T10:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the value of my For Each loop to generate new table scripts</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-the-value-of-my-For-Each-loop-to-generate-new-table/m-p/533678#M75652</link>
      <description>&lt;P&gt;thank you that is indeed working nicely&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2022 10:41:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-the-value-of-my-For-Each-loop-to-generate-new-table/m-p/533678#M75652</guid>
      <dc:creator>mvanderaa1</dc:creator>
      <dc:date>2022-08-15T10:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the value of my For Each loop to generate new table scripts</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-the-value-of-my-For-Each-loop-to-generate-new-table/m-p/534608#M75717</link>
      <description>&lt;P&gt;Hi, I guess I didn't specify as such in my original question, but your solution did change the behaviour of my script since it copies the target script code into the new script. I wanted to keep the reference only to the original script. Here's the final script I'm using, maybe other people might find it useful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Current Data Table();
scriptList = dt &amp;lt;&amp;lt; Get Table Script Names;

For Each( {script_name}, scriptList,
	If( (!Contains( script_name, "Run" ) &amp;amp; !Contains( scriptList, "Run " || script_name )),
		Eval(
			Substitute(
					Expr(
						dt &amp;lt;&amp;lt; New Script(
							"Run " || script_name,
							dt = Current Data Table();
							w = Eval( dt &amp;lt;&amp;lt; get table property( script_placeholder ) );
							w &amp;lt;&amp;lt; set window title( script_placeholder );
						)
					),
				Expr(script_placeholder), Char(script_name)
			)
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Aug 2022 08:02:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-the-value-of-my-For-Each-loop-to-generate-new-table/m-p/534608#M75717</guid>
      <dc:creator>mvanderaa1</dc:creator>
      <dc:date>2022-08-17T08:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the value of my For Each loop to generate new table scripts</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-the-value-of-my-For-Each-loop-to-generate-new-table/m-p/535789#M75805</link>
      <description>&lt;P&gt;&lt;FONT&gt;&lt;FONT&gt;JMP 14 no work.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Aug 2022 01:58:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-the-value-of-my-For-Each-loop-to-generate-new-table/m-p/535789#M75805</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2022-08-21T01:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the value of my For Each loop to generate new table scripts</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-the-value-of-my-For-Each-loop-to-generate-new-table/m-p/535792#M75806</link>
      <description>&lt;P&gt;For Each() function is a new feature in JMP 16.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Aug 2022 02:22:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-the-value-of-my-For-Each-loop-to-generate-new-table/m-p/535792#M75806</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2022-08-21T02:22:08Z</dc:date>
    </item>
  </channel>
</rss>

