<?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 create variable names depending on loop number in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-create-variable-names-depending-on-loop-number/m-p/86931#M38665</link>
    <description>&lt;P&gt;Why create a new variable for each reference? Why not store the data table reference in a list for access by index or an associative array for access by key?&lt;/P&gt;</description>
    <pubDate>Thu, 03 Jan 2019 12:18:43 GMT</pubDate>
    <dc:creator>Mark_Bailey</dc:creator>
    <dc:date>2019-01-03T12:18:43Z</dc:date>
    <item>
      <title>How to create variable names depending on loop number</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-variable-names-depending-on-loop-number/m-p/7422#M7416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I am trying to create variables dynamically depending on the number of times my loop runs. How can I go about doing this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example&lt;/P&gt;&lt;P&gt;for(i=1, i&amp;lt;x, i++, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //some code goes here&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var || i = current data table();&amp;nbsp;&amp;nbsp; //This obviously does not work, but I hope you get the idea. I would eventually like to have var1, var2, var3, etc... till the loop is done&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does this make sense?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Sep 2013 22:25:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-variable-names-depending-on-loop-number/m-p/7422#M7416</guid>
      <dc:creator>abdulj</dc:creator>
      <dc:date>2013-09-17T22:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to create variable names depending on loop number</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-variable-names-depending-on-loop-number/m-p/7423#M7417</link>
      <description>&lt;P&gt;Abdulj,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is one way using Eval ( Substitute ( ))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// dv = dummy variable
x = 10;
For( i = 1, i &amp;lt;= x, i++,
	Eval(
		Substitute(
				Expr(
					dv_variable = i;
					Show( dv_variable );
				),
			Expr( dv_variable ), Parse( "Variable Name " || Char( i ) )
		)
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Michael&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 21:08:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-variable-names-depending-on-loop-number/m-p/7423#M7417</guid>
      <dc:creator>michaelhaslam_p</dc:creator>
      <dc:date>2019-01-02T21:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to create variable names depending on loop number</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-variable-names-depending-on-loop-number/m-p/7424#M7418</link>
      <description>&lt;P&gt;Here is an alternate notation:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For( i = 1, i &amp;lt;= x, i++,
	Eval( Parse( Eval Insert( "\[
        var^i^ = Current Data Table()
    ]\" ) ) )
)&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;-Dave&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 21:09:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-variable-names-depending-on-loop-number/m-p/7424#M7418</guid>
      <dc:creator>David_Burnham</dc:creator>
      <dc:date>2019-01-02T21:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to create variable names depending on loop number</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-variable-names-depending-on-loop-number/m-p/7425#M7419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks guys!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Sep 2013 17:45:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-variable-names-depending-on-loop-number/m-p/7425#M7419</guid>
      <dc:creator>abdulj</dc:creator>
      <dc:date>2013-09-18T17:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to create variable names depending on loop number</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-variable-names-depending-on-loop-number/m-p/7426#M7420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Wasn't there a talk on this at the Advanced Scripting Panel discussion at the JMP Discovery conference Last week? It was a great seminar, I wonder if the author posted any notes on his talk.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Sep 2013 20:05:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-variable-names-depending-on-loop-number/m-p/7426#M7420</guid>
      <dc:creator>Byron_JMP</dc:creator>
      <dc:date>2013-09-19T20:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to create variable names depending on loop number</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-variable-names-depending-on-loop-number/m-p/7427#M7421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dave,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've never seen that syntax before, do the ^ surround any variable to include in text?&amp;nbsp; I would have written:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tmp = "var" || char(i) || " = Current Data Table()";&lt;/P&gt;&lt;P&gt;eval(parse(tmp))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is obviously less efficient than what you've written.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Sep 2013 12:57:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-variable-names-depending-on-loop-number/m-p/7427#M7421</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-09-20T12:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to create variable names depending on loop number</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-variable-names-depending-on-loop-number/m-p/7428#M7422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes enclose each variable with ^ ... ^ and have the jsl statement enclosed in the &lt;STRONG style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Eval( Parse( Eval Insert("\[&lt;/STRONG&gt; ...&lt;STRONG style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; ]\")))&lt;/STRONG&gt; pattern.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, the following code sets spec limits for a column:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Open("$SAMPLE_DATA/Big Class.jmp");&lt;/P&gt;&lt;P&gt;cHeight = Column("height");&lt;/P&gt;&lt;P&gt;Column("height") &amp;lt;&amp;lt; Set Property( "Spec Limits", {LSL(55), USL(75), Target(65)} );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's say we have the following variable assignments that we would like to use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;colName = "height";&lt;/P&gt;&lt;P&gt;lower = 55;&lt;/P&gt;&lt;P&gt;upper = 75;&lt;/P&gt;&lt;P&gt;target = 40;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then we can write:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eval( Parse( Eval Insert("\[&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Column("^colName^") &amp;lt;&amp;lt; Set Property( "Spec Limits", {LSL(^lower^), USL(^upper^), Target(^target^)} );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;]\")))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Dave&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Sep 2013 18:17:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-variable-names-depending-on-loop-number/m-p/7428#M7422</guid>
      <dc:creator>David_Burnham</dc:creator>
      <dc:date>2013-09-20T18:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to create variable names depending on loop number</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-variable-names-depending-on-loop-number/m-p/7429#M7423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;oh nice .... thank you very much. Another thing I need to learn in JMP ... &lt;SPAN __jive_emoticon_name="silly" __jive_macro_name="emoticon" class="jive_macro_emoticon jive_emote jive_macro" src="https://community.jmp.com/7.0.4.3b79b96/images/emoticons/silly.png"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 Apr 2016 13:53:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-variable-names-depending-on-loop-number/m-p/7429#M7423</guid>
      <dc:creator>KinKame</dc:creator>
      <dc:date>2016-04-24T13:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to create variable names depending on loop number</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-create-variable-names-depending-on-loop-number/m-p/86931#M38665</link>
      <description>&lt;P&gt;Why create a new variable for each reference? Why not store the data table reference in a list for access by index or an associative array for access by key?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jan 2019 12:18:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-create-variable-names-depending-on-loop-number/m-p/86931#M38665</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2019-01-03T12:18:43Z</dc:date>
    </item>
  </channel>
</rss>

