<?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: Part of JSL code not working in final script, but working if isolated in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Part-of-JSL-code-not-working-in-final-script-but-working-if/m-p/436645#M68577</link>
    <description>&lt;P&gt;I'm glad you were able to resolve the issue. As for the color coding, it looks like you're using the &amp;lt;/&amp;gt; that's to the left of the &amp;lt;JSL&amp;gt; in the editor toolbar.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might have tried to use them both on the same snippet but only one works. I've fixed the formatting in both your posts.&lt;/P&gt;</description>
    <pubDate>Mon, 15 Nov 2021 21:17:23 GMT</pubDate>
    <dc:creator>Jeff_Perkinson</dc:creator>
    <dc:date>2021-11-15T21:17:23Z</dc:date>
    <item>
      <title>Part of JSL code not working in final script, but working if isolated</title>
      <link>https://community.jmp.com/t5/Discussions/Part-of-JSL-code-not-working-in-final-script-but-working-if/m-p/436383#M68560</link>
      <description>&lt;P&gt;Warning: Beginner level question&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a data table to which I am adding a temporary column (:Parameter_new) to fill up with entries if a certain condition is met. The entries I then want to get into another column (:Parameter_old). My impression is that the code behaves differently when it is part of the final script, compared to when I copy individual lines into a different script. When applying the script code line by line, everything works as expected. When implemented into the final script I only get blank values. Where am I going wrong?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;//Code works OK
  dt &amp;lt;&amp;lt; New Column ("Parameter_new", character);										
  dt &amp;lt;&amp;lt; go to( :Parameter_new ) &amp;lt;&amp;lt; move selected columns( After( :Parameter_old ));				

  For Each Row(
	  If(:Parameter_old == "Parameter x",
		 :Parameter_new = :Parameter_old || " " || "by" || " " ||:Method_description));			

  dt &amp;lt;&amp;lt; select where(:Parameter_old == "Parameter x");

//Code does not work and deletes all entries in column "Parameter_old", i.e. cells come out blank
//Code does however work if applied individually, line by line
  :Name("Parameter_old")[dt &amp;lt;&amp;lt; get selected rows] = :Parameter_new;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 18:05:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Part-of-JSL-code-not-working-in-final-script-but-working-if/m-p/436383#M68560</guid>
      <dc:creator>Ressel</dc:creator>
      <dc:date>2023-06-09T18:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: Part of JSL code not working in final script, but working if isolated</title>
      <link>https://community.jmp.com/t5/Discussions/Part-of-JSL-code-not-working-in-final-script-but-working-if/m-p/436409#M68562</link>
      <description>&lt;P&gt;JMP probably is not evaluating the formula in Parameter_new before moving to the next line.&amp;nbsp; Try adding this after your For Each Row function:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; Run Formulas;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also, you could use a wait:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Wait(0);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Nov 2021 13:33:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Part-of-JSL-code-not-working-in-final-script-but-working-if/m-p/436409#M68562</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2021-11-15T13:33:57Z</dc:date>
    </item>
    <item>
      <title>Re: Part of JSL code not working in final script, but working if isolated</title>
      <link>https://community.jmp.com/t5/Discussions/Part-of-JSL-code-not-working-in-final-script-but-working-if/m-p/436558#M68566</link>
      <description>&lt;P&gt;The final statement has a matrix on the left-hand-side (LHS) and a column on the right-hand-side (RHS).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have two different cases: inside the ForEachRow, and outside. If inside, there is an implicit row and the column resolves to a scalar. If outside, there is not an implicit row. You probably had exactly one row selected when it worked inside the ForEachRow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;a column matrix (LHS) only supports a scalar on the RHS. It won't work right with a matrix on the RHS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use &lt;LI-MESSAGE title="Data table subscripting" uid="21013" url="https://community.jmp.com/t5/Uncharted/Data-table-subscripting/m-p/21013#U21013" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-blog-thread lia-fa-icon lia-fa-blog lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp; instead. That treats the table as a 2D matrix (3 rows, 1 col in this tiny example.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$sample_data/big class.jmp" );
dt[[2, 3, 4], {name}] = dt[[5, 6, 7], {name}];&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Nov 2021 16:48:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Part-of-JSL-code-not-working-in-final-script-but-working-if/m-p/436558#M68566</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2021-11-15T16:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: Part of JSL code not working in final script, but working if isolated</title>
      <link>https://community.jmp.com/t5/Discussions/Part-of-JSL-code-not-working-in-final-script-but-working-if/m-p/436619#M68572</link>
      <description>&lt;P&gt;Thanks ih, I appreciate the response! Tried both, didn't work. Open to suggestions while fishing in the Scripting Guide.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Nov 2021 19:36:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Part-of-JSL-code-not-working-in-final-script-but-working-if/m-p/436619#M68572</guid>
      <dc:creator>Ressel</dc:creator>
      <dc:date>2021-11-15T19:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: Part of JSL code not working in final script, but working if isolated</title>
      <link>https://community.jmp.com/t5/Discussions/Part-of-JSL-code-not-working-in-final-script-but-working-if/m-p/436623#M68573</link>
      <description>&lt;P&gt;Thanks. Looks interesting. Please give me some time before I have sorted out the details around this approach, can post my initial code in complete form and accept your post as solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Also, why is my JSL code formatted without colour in my posting? I am using the &amp;lt;JSL&amp;gt; icon for inserting snippets.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: Wonderful post about subscripting. Wasn't aware of that, but made for some interesting reading. I have since accepted a response from myself as solution, since it appeared intuitively easier to me.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Nov 2021 20:21:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Part-of-JSL-code-not-working-in-final-script-but-working-if/m-p/436623#M68573</guid>
      <dc:creator>Ressel</dc:creator>
      <dc:date>2021-11-15T20:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: Part of JSL code not working in final script, but working if isolated</title>
      <link>https://community.jmp.com/t5/Discussions/Part-of-JSL-code-not-working-in-final-script-but-working-if/m-p/436625#M68574</link>
      <description>&lt;P&gt;Do I feel stupid learning about Ifs now...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, why is my JSL code snippet all grey? How can I get the correct font &amp;amp; colours?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt2 &amp;lt;&amp;lt; New Column ("Parameter_new", character);
dt2 &amp;lt;&amp;lt; go to( :Parameter_new ) &amp;lt;&amp;lt; move selected columns( After( :Parameter_old ));
		
For Each Row(
	If(	:Parameter_old == "Parameter x", :Parameter_new = :Parameter_old || " " || "by" || " " || :Method_description,
		:Parameter_old != "Parameter x", :Parameter = :Parameter_old));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Nov 2021 21:14:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Part-of-JSL-code-not-working-in-final-script-but-working-if/m-p/436625#M68574</guid>
      <dc:creator>Ressel</dc:creator>
      <dc:date>2021-11-15T21:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: Part of JSL code not working in final script, but working if isolated</title>
      <link>https://community.jmp.com/t5/Discussions/Part-of-JSL-code-not-working-in-final-script-but-working-if/m-p/436645#M68577</link>
      <description>&lt;P&gt;I'm glad you were able to resolve the issue. As for the color coding, it looks like you're using the &amp;lt;/&amp;gt; that's to the left of the &amp;lt;JSL&amp;gt; in the editor toolbar.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might have tried to use them both on the same snippet but only one works. I've fixed the formatting in both your posts.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Nov 2021 21:17:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Part-of-JSL-code-not-working-in-final-script-but-working-if/m-p/436645#M68577</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2021-11-15T21:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: Part of JSL code not working in final script, but working if isolated</title>
      <link>https://community.jmp.com/t5/Discussions/Part-of-JSL-code-not-working-in-final-script-but-working-if/m-p/436722#M68581</link>
      <description>&lt;P&gt;All of my &amp;lt;JSL&amp;gt; code blocks get flagged for errors when posting here to the Community forums.&amp;nbsp; Specifically, the `class=" language-jsl"` inside the &amp;lt;code&amp;gt; block gets removed, as below&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Names Default To Here( 1 );
x = [10, 50, 90];
y = [10, 90, 10];
New Window( "Line Seg Example", g = Graph Box( Line Seg( x, y ) ) );
frame = g[FrameBox( 1 )];
seg = (frame &amp;lt;&amp;lt; Find Seg( Line Seg( 1 ) ));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ErraticAttach_0-1637024605324.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/37606i5C875523B14D8A5F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ErraticAttach_0-1637024605324.png" alt="ErraticAttach_0-1637024605324.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 01:03:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Part-of-JSL-code-not-working-in-final-script-but-working-if/m-p/436722#M68581</guid>
      <dc:creator>ErraticAttack</dc:creator>
      <dc:date>2021-11-16T01:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: Part of JSL code not working in final script, but working if isolated</title>
      <link>https://community.jmp.com/t5/Discussions/Part-of-JSL-code-not-working-in-final-script-but-working-if/m-p/437031#M68605</link>
      <description>&lt;P&gt;Hi. There appears to have been a change in the Community platform. We have contacted support. In the meantime, we have implemented a temporary fix which should allow you to use the &amp;lt;JSL&amp;gt; button as expected. Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 15:51:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Part-of-JSL-code-not-working-in-final-script-but-working-if/m-p/437031#M68605</guid>
      <dc:creator>Ryan_Gilmore</dc:creator>
      <dc:date>2021-11-16T15:51:27Z</dc:date>
    </item>
  </channel>
</rss>

