<?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: For Each() syntax in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586695#M79223</link>
    <description>&lt;P&gt;I've fiddled with the syntax as in the Scripting Index, but the same error still holds true. This must mean that there's something I'm not understanding with my particular setup. I need to test some more things and will post here on my findings and/or additional questions.&amp;nbsp; Thank you,&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;</description>
    <pubDate>Wed, 04 Jan 2023 17:44:54 GMT</pubDate>
    <dc:creator>StarfruitBob</dc:creator>
    <dc:date>2023-01-04T17:44:54Z</dc:date>
    <item>
      <title>For Each() syntax</title>
      <link>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586668#M79219</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking to expand the number of values that can be used in the For Each() function.&amp;nbsp; In the scripting index and handful of examples I've found within JMP community and JMP itself, combined, I've only seen a single value and index used: For each( { val1, index}, ... ). I'd like to use: For each( { val1, val2, ..., valn, index}, ...) . When I increase the number of values in the curly braces, a "too many arguments" error pops up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Strangely, this error message states that the row number of the error corresponds to the total number of rows in the matrix that is passed into the For each() function, not the actual row number of that function in the script. I can confirm it's the number of values I'm attempting to use, and not the number of rows in the matrix I'm passing into the function, by changing the number of values to val1 &amp;amp; index only, which then works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The matrix that is passed in has an equal number of columns as the number of values I want to pass into the For Each() function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any tips? Is this possible?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 16:44:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586668#M79219</guid>
      <dc:creator>StarfruitBob</dc:creator>
      <dc:date>2023-06-08T16:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: For Each() syntax</title>
      <link>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586686#M79221</link>
      <description>&lt;P&gt;For Each documentation in Scripting Index does cover this somewhat. Example for Across gives the best idea for syntax&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1672852962357.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48801i4E17AFD6D6C41DE5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1672852962357.png" alt="jthi_0-1672852962357.png" /&gt;&lt;/span&gt;&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);
// Across multiple containers
x = {"a", "b"};
y = {"d", "c"};
For Each({{a, b}, index}, Across(x, y), Show(a||b, index));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Jan 2023 17:26:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586686#M79221</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-01-04T17:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: For Each() syntax</title>
      <link>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586695#M79223</link>
      <description>&lt;P&gt;I've fiddled with the syntax as in the Scripting Index, but the same error still holds true. This must mean that there's something I'm not understanding with my particular setup. I need to test some more things and will post here on my findings and/or additional questions.&amp;nbsp; Thank you,&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2023 17:44:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586695#M79223</guid>
      <dc:creator>StarfruitBob</dc:creator>
      <dc:date>2023-01-04T17:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: For Each() syntax</title>
      <link>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586718#M79226</link>
      <description>&lt;P&gt;I think this is another piece to the puzzle:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Across() formatting for multiple containers is in use.&amp;nbsp; With the number of values I have it makes sense, but this also requires Across().&amp;nbsp; Currently, I'm saving a data table to a matrix with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;matrix1 = dt1 &amp;lt;&amp;lt; Get as Matrix();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;How is Across() properly populated to either work with that, or a data table correctly, since the number of items in Across() needs to equal the number of containers (values) in the curly braces?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2023 18:37:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586718#M79226</guid>
      <dc:creator>StarfruitBob</dc:creator>
      <dc:date>2023-01-04T18:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: For Each() syntax</title>
      <link>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586721#M79227</link>
      <description>&lt;P&gt;What are you actually trying to do?&amp;nbsp; Or are you JUST trying to understand the syntax?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2023 19:09:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586721#M79227</guid>
      <dc:creator>vince_faller</dc:creator>
      <dc:date>2023-01-04T19:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: For Each() syntax</title>
      <link>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586726#M79229</link>
      <description>&lt;P&gt;I have 3 tables:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;dt1: measured values &amp;amp; prediction formulas&lt;/LI&gt;&lt;LI&gt;dt2: target values (currently saved as matrix):&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;matrix1 = dt2 &amp;lt;&amp;lt; Get as Matrix();​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;dt3: table to record coefficients from regression formula from (Prediction) Profiler tool&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;What I'm hoping to do is to use For Each() to iterate through dt2, use the corresponding prediction formula in dt1, and then record the corresponding coefficients that the&amp;nbsp;(Prediction) Profiler generates. I'm sure I can do this with a standard For() loop, but was advised that For Each() would be a better option.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2023 19:27:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586726#M79229</guid>
      <dc:creator>StarfruitBob</dc:creator>
      <dc:date>2023-01-04T19:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: For Each() syntax</title>
      <link>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586784#M79233</link>
      <description>&lt;P&gt;Is this just to get absolute values of the prediction?&amp;nbsp; I'm confused sorry.&amp;nbsp;&amp;nbsp;&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;Names default to here( 1 );
dt1 = open("$SAMPLE_DATA\Big Class.jmp");
fm = dt1 &amp;lt;&amp;lt; Fit Model(
	Y( :height, :weight ),
	Effects( :age, :sex, :age * :sex ),
	Personality( "Standard Least Squares" ),
	Emphasis( "Effect Leverage" ),
	Run(
		:height &amp;lt;&amp;lt; {Summary of Fit( 1 ), Analysis of Variance( 1 ),
		Parameter Estimates( 1 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
		Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
		Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
		Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
		Box Cox Y Transformation( 0 )},
		:weight &amp;lt;&amp;lt; {Summary of Fit( 1 ), Analysis of Variance( 1 ),
		Parameter Estimates( 1 ), Lack of Fit( 0 ), Scaled Estimates( 0 ),
		Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
		Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
		Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
		Box Cox Y Transformation( 0 )}
	)
);
fm &amp;lt;&amp;lt; Prediction Formula; //  

dt2 = new table("Targets", 
	&amp;lt;&amp;lt;New Column("age", &amp;lt;&amp;lt;Set Values([12, 14])), 
	&amp;lt;&amp;lt; New Column("sex", character, &amp;lt;&amp;lt;Set Values({"M", "F"}))
);

Eval(EvalExpr(dt2 &amp;lt;&amp;lt; New Column("Pred Formula height", formula(Expr(dt1:Pred Formula height &amp;lt;&amp;lt; Get Formula)))));
Eval(EvalExpr(dt2 &amp;lt;&amp;lt; New Column("Pred Formula weight", formula(Expr(dt1:Pred Formula weight &amp;lt;&amp;lt; Get Formula)))));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Jan 2023 21:24:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586784#M79233</guid>
      <dc:creator>vince_faller</dc:creator>
      <dc:date>2023-01-04T21:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: For Each() syntax</title>
      <link>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586785#M79234</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2610"&gt;@vince_faller&lt;/a&gt;&amp;nbsp;, it's all good! Once a prediction formula is generated from a dataset (within dt1), I then want to use the ideal solution (within dt2) and work backwards to grab the coefficients needed to obtain this ideal value (saved in dt3). The prediction profiler displays the coefficients of the values necessary to do this, so I'd need to grab the values from the boxes.&lt;BR /&gt;&lt;BR /&gt;I have a test using the For() loop going on as we speak, in the background.&amp;nbsp; If it works, I can scrap using For Each() entire for this project.&amp;nbsp; Although, now that I'm encountering issues, it makes me even more encouraged to understand why.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2023 21:30:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586785#M79234</guid>
      <dc:creator>StarfruitBob</dc:creator>
      <dc:date>2023-01-04T21:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: For Each() syntax</title>
      <link>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586794#M79236</link>
      <description>&lt;P&gt;There's a different structure to the arguments if you're trying to loop through matrices. If you look under the little pull down menu in the scripting index, there are examples of the different configurations the For Each() loop can take.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeD_Anderson_0-1672868440129.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/48817iB8C220436CCDD686/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeD_Anderson_0-1672868440129.png" alt="MikeD_Anderson_0-1672868440129.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;M&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2023 21:43:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586794#M79236</guid>
      <dc:creator>MikeD_Anderson</dc:creator>
      <dc:date>2023-01-04T21:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: For Each() syntax</title>
      <link>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586797#M79237</link>
      <description>&lt;P&gt;Thank you, &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4530"&gt;@MikeD_Anderson&lt;/a&gt;&amp;nbsp;.&amp;nbsp; I've already spent over a day going through each of these options, but the error I mentioned in the original post is what's blocking me.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2023 21:48:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586797#M79237</guid>
      <dc:creator>StarfruitBob</dc:creator>
      <dc:date>2023-01-04T21:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: For Each() syntax</title>
      <link>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586989#M79250</link>
      <description>&lt;P&gt;I think the piece you're missing in the examples is that the values you want to pull have to be in the form of a single value or a list. &amp;nbsp;So&amp;nbsp;&lt;SPAN&gt;For each( { val1, val2, ..., valn, index}, ...)&amp;nbsp;&lt;/SPAN&gt;wouldn't work because there's too much stuff in the argument list. &amp;nbsp;But&amp;nbsp;&lt;SPAN&gt;For each( { {val1, val2, ..., valn}, index}, ...)&amp;nbsp;might work better. &amp;nbsp;That's also in line with the example that&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;provided earlier. &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;M&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 15:02:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/586989#M79250</guid>
      <dc:creator>MikeD_Anderson</dc:creator>
      <dc:date>2023-01-05T15:02:47Z</dc:date>
    </item>
    <item>
      <title>Re: For Each() syntax</title>
      <link>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/587174#M79263</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've already investigated the double curly braces, but I'm running across the "too many argument" error as in my original post.&amp;nbsp; I believe this because I haven't specified the correct number of containers in Across(). I do not know how to properly fill out Across().&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At this time, my For() loop alternative is fleshing out very nicely and should replace the need for the For Each() function. However, I'd still like to learn how to use it properly, but perhaps I'll resurrect this thread at a different time. My focus is needed elsewhere for a while.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you all for the discussion!&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2023 22:39:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/For-Each-syntax/m-p/587174#M79263</guid>
      <dc:creator>StarfruitBob</dc:creator>
      <dc:date>2023-01-05T22:39:57Z</dc:date>
    </item>
  </channel>
</rss>

