<?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 Pass a Script Variable into a New Script in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Pass-a-Script-Variable-into-a-New-Script/m-p/60573#M32986</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Basically I am trying to use a for loop to imbed multiple scripts into a data table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( SV = 1, SV &amp;lt;= N Items( CL ), SV++,
	DT2 &amp;lt;&amp;lt; New Script(
		Char(SV),
			For( x = 7, x &amp;lt;= N Items( ColLst ), x++,
				:Column(Char(ColLst[x])) &amp;lt;&amp;lt; Hide (1);
			);
			For( w = 1, w &amp;lt;= N Items( Lst ), w++,
				:Column(Char(CL[SV][w])) &amp;lt;&amp;lt; Hide (0);
			);
	);
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The problem is when one of these scripts run it doesn't know what SV is. I need a way of capturing SV from the main script and setting it into the New Script. For example if I replace SV with 1 all the imbedded scripts will work as if SV == 1, so I need the For Loop to "set" SV to the correct value for that script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully this makes some kind of sense.&lt;/P&gt;</description>
    <pubDate>Tue, 19 Jun 2018 08:53:52 GMT</pubDate>
    <dc:creator>david707</dc:creator>
    <dc:date>2018-06-19T08:53:52Z</dc:date>
    <item>
      <title>Pass a Script Variable into a New Script</title>
      <link>https://community.jmp.com/t5/Discussions/Pass-a-Script-Variable-into-a-New-Script/m-p/60573#M32986</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Basically I am trying to use a for loop to imbed multiple scripts into a data table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( SV = 1, SV &amp;lt;= N Items( CL ), SV++,
	DT2 &amp;lt;&amp;lt; New Script(
		Char(SV),
			For( x = 7, x &amp;lt;= N Items( ColLst ), x++,
				:Column(Char(ColLst[x])) &amp;lt;&amp;lt; Hide (1);
			);
			For( w = 1, w &amp;lt;= N Items( Lst ), w++,
				:Column(Char(CL[SV][w])) &amp;lt;&amp;lt; Hide (0);
			);
	);
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The problem is when one of these scripts run it doesn't know what SV is. I need a way of capturing SV from the main script and setting it into the New Script. For example if I replace SV with 1 all the imbedded scripts will work as if SV == 1, so I need the For Loop to "set" SV to the correct value for that script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully this makes some kind of sense.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 08:53:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Pass-a-Script-Variable-into-a-New-Script/m-p/60573#M32986</guid>
      <dc:creator>david707</dc:creator>
      <dc:date>2018-06-19T08:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a Script Variable into a New Script</title>
      <link>https://community.jmp.com/t5/Discussions/Pass-a-Script-Variable-into-a-New-Script/m-p/60594#M33000</link>
      <description>&lt;P&gt;Try using &lt;EM&gt;Eval( Eval Expr(...Expr(SV)...))&amp;nbsp;&lt;/EM&gt;to force pre-evaluation of SV (and CL if necessary).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 14:53:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Pass-a-Script-Variable-into-a-New-Script/m-p/60594#M33000</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2018-06-19T14:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a Script Variable into a New Script</title>
      <link>https://community.jmp.com/t5/Discussions/Pass-a-Script-Variable-into-a-New-Script/m-p/60595#M33001</link>
      <description>&lt;P&gt;I tried:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( SV = 1, SV &amp;lt;= N Items( CL ), SV++,
	DT2 &amp;lt;&amp;lt; New Script(                                                         
		Char(SV),
			For( x = 6, x &amp;lt;= N Items( ColLst ), x++,
				:Column(Char(ColLst[x])) &amp;lt;&amp;lt; Hide (1);
			);
			For( w = 1, w &amp;lt;= N Items(
					Eval(
						Eval Expr(
							Expr(
								CL[
									Eval(
										Eval Expr(
											Expr(SV)
										)
									)
								]
							)
						)
					) 
				), w++,
				:Column(
					Char(
						Eval(
							Eval Expr(
								CL[
									Eval(
										Eval Expr(
											Expr(SV)
										)
									)
								][w]
							)
						)
					)
				) &amp;lt;&amp;lt; Hide (0);
			);
	);
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The error is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Subscript Range in access or evaluation of 'Subscript' , CL[/*###*/Eval( Eval Expr( Expr( SV ) ) )]&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Jun 2018 15:10:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Pass-a-Script-Variable-into-a-New-Script/m-p/60595#M33001</guid>
      <dc:creator>david707</dc:creator>
      <dc:date>2018-06-19T15:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a Script Variable into a New Script</title>
      <link>https://community.jmp.com/t5/Discussions/Pass-a-Script-Variable-into-a-New-Script/m-p/60599#M33004</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( SV = 1, SV &amp;lt;= N Items( CL ), SV++,
	Eval(Parse(Eval Insert("DT2 &amp;lt;&amp;lt; New Script(
		Char(SV),
			For( x = 7, x &amp;lt;= N Items( ColLst ), x++,
				:Column(Char(ColLst[x])) &amp;lt;&amp;lt; Hide (1);
			);
			For( w = 1, w &amp;lt;= N Items( Lst ), w++,
				:Column(Char(CL[^SV^][w])) &amp;lt;&amp;lt; Hide (0);
			);
		);"
	)));
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jun 2018 16:52:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Pass-a-Script-Variable-into-a-New-Script/m-p/60599#M33004</guid>
      <dc:creator>cwillden</dc:creator>
      <dc:date>2018-06-19T16:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: Pass a Script Variable into a New Script</title>
      <link>https://community.jmp.com/t5/Discussions/Pass-a-Script-Variable-into-a-New-Script/m-p/232442#M46107</link>
      <description>&lt;P&gt;In general you can use this method to pass variable into a script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Eval (eval expr(
	dt &amp;lt;&amp;lt; New script (
		"name",
		Bivariate(
			Y(expr(col_var)),
			X(expr(col_list_var))
		)
	)
));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2019 09:20:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Pass-a-Script-Variable-into-a-New-Script/m-p/232442#M46107</guid>
      <dc:creator>akopel</dc:creator>
      <dc:date>2019-11-06T09:20:21Z</dc:date>
    </item>
  </channel>
</rss>

