<?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: recode script in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/recode-script/m-p/49014#M27840</link>
    <description>&lt;P&gt;You need to send this as a message to your data table.&amp;nbsp; Here's one way to do it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = current data table();

dt &amp;lt;&amp;lt; Add Properties to Table(
{New Script(
"Recode",
Current Data Table() &amp;lt;&amp;lt; Begin Data Update;
For Each Row( :purity_2 = Match( :purity_2, 0, ., ., ., :purity_2 ) );
For Each Row( :purity_3 = Match( :purity_3, 0, ., ., ., :purity_3 ) );
For Each Row( :purity_4 = Match( :purity_4, 0, ., ., ., :purity_4 ) );
For Each Row( :plus50_2 = Match( :plus50_2, 0, ., ., ., :plus50_2 ) );
For Each Row( :plus100_2 = Match( :plus100_2, 0, ., ., ., :plus100_2 ) );
For Each Row( :plus140_2 = Match( :plus140_2, 0, ., ., ., :plus140_2 ) );
Current Data Table() &amp;lt;&amp;lt; End Data Update;
)});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 22 Dec 2017 16:07:16 GMT</pubDate>
    <dc:creator>pmroz</dc:creator>
    <dc:date>2017-12-22T16:07:16Z</dc:date>
    <item>
      <title>recode script</title>
      <link>https://community.jmp.com/t5/Discussions/recode-script/m-p/49009#M27836</link>
      <description>&lt;P&gt;I am trying to recode data (0 to .) after I pull it in from an sql server using the post querry scipt. I am getting an error at the end of my script. I am able to run the script through on the data table itself but would like this to happen automatically when I put in the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my scipt.&lt;/P&gt;&lt;P class="p1"&gt;Add Properties to Table(&lt;/P&gt;&lt;P class="p1"&gt;{New Script(&lt;/P&gt;&lt;P class="p2"&gt;"Recode"&lt;SPAN class="s1"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p3"&gt;Current Data Table&lt;SPAN class="s1"&gt;() &amp;lt;&amp;lt; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;Begin Data Update&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s3"&gt;For Each Row&lt;/SPAN&gt;( :purity_2 = &lt;SPAN class="s3"&gt;Match&lt;/SPAN&gt;( :purity_2, &lt;SPAN class="s4"&gt;0&lt;/SPAN&gt;, &lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;, &lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;, &lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;, :purity_2 ) );&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s3"&gt;For Each Row&lt;/SPAN&gt;( :purity_3 = &lt;SPAN class="s3"&gt;Match&lt;/SPAN&gt;( :purity_3, &lt;SPAN class="s4"&gt;0&lt;/SPAN&gt;, &lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;, &lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;, &lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;, :purity_3 ) );&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s3"&gt;For Each Row&lt;/SPAN&gt;( :purity_4 = &lt;SPAN class="s3"&gt;Match&lt;/SPAN&gt;( :purity_4, &lt;SPAN class="s4"&gt;0&lt;/SPAN&gt;, &lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;, &lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;, &lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;, :purity_4 ) );&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s3"&gt;For Each Row&lt;/SPAN&gt;( :plus50_2 = &lt;SPAN class="s3"&gt;Match&lt;/SPAN&gt;( :plus50_2, &lt;SPAN class="s4"&gt;0&lt;/SPAN&gt;, &lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;, &lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;, &lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;, :plus50_2 ) );&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s3"&gt;For Each Row&lt;/SPAN&gt;( :plus100_2 = &lt;SPAN class="s3"&gt;Match&lt;/SPAN&gt;( :plus100_2, &lt;SPAN class="s4"&gt;0&lt;/SPAN&gt;, &lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;, &lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;, &lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;, :plus100_2 ) );&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s3"&gt;For Each Row&lt;/SPAN&gt;( :plus140_2 = &lt;SPAN class="s3"&gt;Match&lt;/SPAN&gt;( :plus140_2, &lt;SPAN class="s4"&gt;0&lt;/SPAN&gt;, &lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;, &lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;, &lt;SPAN class="s4"&gt;.&lt;/SPAN&gt;, :plus140_2 ) );&lt;/P&gt;&lt;P class="p3"&gt;Current Data Table&lt;SPAN class="s1"&gt;() &amp;lt;&amp;lt; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;End Data Update&lt;/SPAN&gt;&lt;SPAN class="s1"&gt;;)}&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p3"&gt;&lt;SPAN class="s1"&gt;Here is the error message:&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;Unexpected end of input. Perhaps there is a missing "," or ")".&lt;/P&gt;&lt;P class="p1"&gt;Trying to parse arguments of function "Add Properties to Table".&lt;/P&gt;&lt;P class="p1"&gt;Line 60 Column 45: &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;Current Data Table() &amp;lt;&amp;lt; End Data Update;)}►&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;Thanks,&lt;/P&gt;&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p3"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2017 14:52:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/recode-script/m-p/49009#M27836</guid>
      <dc:creator>mallen810</dc:creator>
      <dc:date>2017-12-22T14:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: recode script</title>
      <link>https://community.jmp.com/t5/Discussions/recode-script/m-p/49010#M27837</link>
      <description>&lt;P&gt;You're missing a close parentheses at the end.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Current Data Table() &amp;lt;&amp;lt; End Data Update;)}&lt;STRONG&gt;);&lt;/STRONG&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Dec 2017 14:57:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/recode-script/m-p/49010#M27837</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2017-12-22T14:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: recode script</title>
      <link>https://community.jmp.com/t5/Discussions/recode-script/m-p/49012#M27838</link>
      <description>That did not work, I got the following message.&lt;BR /&gt;&lt;BR /&gt;Add Properties to Table(&lt;BR /&gt;{New Script(&lt;BR /&gt;"Recode",&lt;BR /&gt;Current Data Table() &amp;lt;&amp;lt; Begin Data Update;&lt;BR /&gt;For Each Row( :purity_2 = Match( :purity_2, 0, ., ., ., :purity_2 ) );&lt;BR /&gt;For Each Row( :purity_3 = Match( :purity_3, 0, ., ., ., :purity_3 ) );&lt;BR /&gt;For Each Row( :purity_4 = Match( :purity_4, 0, ., ., ., :purity_4 ) );&lt;BR /&gt;For Each Row( :plus50_2 = Match( :plus50_2, 0, ., ., ., :plus50_2 ) );&lt;BR /&gt;For Each Row( :plus100_2 = Match( :plus100_2, 0, ., ., ., :plus100_2 ) );&lt;BR /&gt;For Each Row( :plus140_2 = Match( :plus140_2, 0, ., ., ., :plus140_2 ) );&lt;BR /&gt;Current Data Table() &amp;lt;&amp;lt; End Data Update;&lt;BR /&gt;)}&lt;BR /&gt;) /*###*/;&lt;BR /&gt;</description>
      <pubDate>Fri, 22 Dec 2017 15:47:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/recode-script/m-p/49012#M27838</guid>
      <dc:creator>mallen810</dc:creator>
      <dc:date>2017-12-22T15:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: recode script</title>
      <link>https://community.jmp.com/t5/Discussions/recode-script/m-p/49013#M27839</link>
      <description>&lt;P&gt;I am not really experienced in using the "Add Properties to Table()" however in reading the definition in the Scripting Index, it doesn't appear that what you are trying to do will work.&amp;nbsp; The following simplification of your script will work&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );
Current Data Table() &amp;lt;&amp;lt; New Script(
	"Recode",
	Current Data Table() &amp;lt;&amp;lt; Begin Data Update;
	For Each Row( :purity_2 = Match( :purity_2, 0, ., ., ., :purity_2 ) );
	For Each Row( :purity_3 = Match( :purity_3, 0, ., ., ., :purity_3 ) );
	For Each Row( :purity_4 = Match( :purity_4, 0, ., ., ., :purity_4 ) );
	For Each Row( :plus50_2 = Match( :plus50_2, 0, ., ., ., :plus50_2 ) );
	For Each Row( :plus100_2 = Match( :plus100_2, 0, ., ., ., :plus100_2 ) );
	For Each Row( :plus140_2 = Match( :plus140_2, 0, ., ., ., :plus140_2 ) );
	Current Data Table() &amp;lt;&amp;lt; End Data Update;
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Dec 2017 16:07:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/recode-script/m-p/49013#M27839</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2017-12-22T16:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: recode script</title>
      <link>https://community.jmp.com/t5/Discussions/recode-script/m-p/49014#M27840</link>
      <description>&lt;P&gt;You need to send this as a message to your data table.&amp;nbsp; Here's one way to do it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = current data table();

dt &amp;lt;&amp;lt; Add Properties to Table(
{New Script(
"Recode",
Current Data Table() &amp;lt;&amp;lt; Begin Data Update;
For Each Row( :purity_2 = Match( :purity_2, 0, ., ., ., :purity_2 ) );
For Each Row( :purity_3 = Match( :purity_3, 0, ., ., ., :purity_3 ) );
For Each Row( :purity_4 = Match( :purity_4, 0, ., ., ., :purity_4 ) );
For Each Row( :plus50_2 = Match( :plus50_2, 0, ., ., ., :plus50_2 ) );
For Each Row( :plus100_2 = Match( :plus100_2, 0, ., ., ., :plus100_2 ) );
For Each Row( :plus140_2 = Match( :plus140_2, 0, ., ., ., :plus140_2 ) );
Current Data Table() &amp;lt;&amp;lt; End Data Update;
)});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Dec 2017 16:07:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/recode-script/m-p/49014#M27840</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2017-12-22T16:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: recode script</title>
      <link>https://community.jmp.com/t5/Discussions/recode-script/m-p/49015#M27841</link>
      <description>&lt;P&gt;Edit: Ignore this, it is the same as Jim's post, above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can also send the New Script message directly to the table:&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; New Script(
"Recode 2",
Current Data Table() &amp;lt;&amp;lt; Begin Data Update;
For Each Row( :purity_2 = Match( :purity_2, 0, ., ., ., :purity_2 ) );
For Each Row( :purity_3 = Match( :purity_3, 0, ., ., ., :purity_3 ) );
For Each Row( :purity_4 = Match( :purity_4, 0, ., ., ., :purity_4 ) );
For Each Row( :plus50_2 = Match( :plus50_2, 0, ., ., ., :plus50_2 ) );
For Each Row( :plus100_2 = Match( :plus100_2, 0, ., ., ., :plus100_2 ) );
For Each Row( :plus140_2 = Match( :plus140_2, 0, ., ., ., :plus140_2 ) );
Current Data Table() &amp;lt;&amp;lt; End Data Update;
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Dec 2017 16:25:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/recode-script/m-p/49015#M27841</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2017-12-22T16:25:29Z</dc:date>
    </item>
  </channel>
</rss>

