<?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 perform &amp;quot;find &amp;amp; replace&amp;quot; in specific a column using JSL script? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-perform-quot-find-amp-replace-quot-in-specific-a-column/m-p/405901#M65602</link>
    <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/5080"&gt;@DonMcCormack&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The big win on a lot of the ways you might do this will be to use the Begin/End Data Update as &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt; showed. Here's another way to do it:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$sample_data/big class.jmp" );
dt &amp;lt;&amp;lt; Begin Data Update;
For Each Row( dt,
	dt:name = Substitute( dt:name, 
		"A", "a",
		"E", "e",
		"I", "i",
		"O", "o",
		"U", "u"
	)
);
dt &amp;lt;&amp;lt; End Data Update;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Lower case vowels." style="width: 564px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/34652i2EA1815005A720A0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Lower case vowels." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Lower case vowels.&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 30 Jul 2021 15:02:55 GMT</pubDate>
    <dc:creator>Craige_Hales</dc:creator>
    <dc:date>2021-07-30T15:02:55Z</dc:date>
    <item>
      <title>How to perform "find &amp; replace" in specific a column using JSL script?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-perform-quot-find-amp-replace-quot-in-specific-a-column/m-p/405662#M65571</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;How can I re-create the "Find &amp;amp; replace" operation on a specific column by JSL script?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example - I want to replace "K" with "1e3" &amp;amp; "M" with "1e6" in "Count" column&lt;/P&gt;&lt;P&gt;(to convert it to numeric type later).&lt;/P&gt;&lt;P&gt;I didn't find a simple way to do it without using a loop (there so it would be fast when many rows needs to be checked)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Snapshot.JPG" style="width: 181px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/34644i5B49B3CBA58C7848/image-size/large?v=v2&amp;amp;px=999" role="button" title="Snapshot.JPG" alt="Snapshot.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks :)&lt;/img&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 19:53:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-perform-quot-find-amp-replace-quot-in-specific-a-column/m-p/405662#M65571</guid>
      <dc:creator>Adi-B</dc:creator>
      <dc:date>2023-06-09T19:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform "find &amp; replace" in specific a column using JSL script?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-perform-quot-find-amp-replace-quot-in-specific-a-column/m-p/405685#M65574</link>
      <description>&lt;P&gt;I think Recode can do this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1627585336538.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/34647iE76368648FEB1F27/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1627585336538.png" alt="jthi_0-1627585336538.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_1-1627585341000.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/34648iC8C10DE303D638D1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_1-1627585341000.png" alt="jthi_1-1627585341000.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Other way would be creating new column with some sort of column:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;conversionAa = ["K" =&amp;gt; "1e3", "M" =&amp;gt; "1e6"];
If(Contains(conversionAa, Right(:Count, 1)),
	Substitute(:Count, Right(:Count,1), conversionAa[Right(:Count, 1)])
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;My suggestion would be to use Recode and if you need the script you can get it from the Recode platform:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Data Table("Untitled");
dt &amp;lt;&amp;lt; Begin Data Update;
col1 = dt &amp;lt;&amp;lt; New Column(dt:Count);
col1 &amp;lt;&amp;lt; Set Name("Count 2");
dt &amp;lt;&amp;lt; Move Selected Columns({col1}, after(dt:Count));
dt &amp;lt;&amp;lt; Recode Column(
	dt:Count,
	{Substitute(_rcNow, "K", "1e3"), Substitute(_rcNow, "M", "1e6")},
	Target Column(col1)
);
dt &amp;lt;&amp;lt; End Data Update;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Jul 2021 19:15:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-perform-quot-find-amp-replace-quot-in-specific-a-column/m-p/405685#M65574</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2021-07-29T19:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform "find &amp; replace" in specific a column using JSL script?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-perform-quot-find-amp-replace-quot-in-specific-a-column/m-p/405901#M65602</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/5080"&gt;@DonMcCormack&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The big win on a lot of the ways you might do this will be to use the Begin/End Data Update as &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt; showed. Here's another way to do it:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Open( "$sample_data/big class.jmp" );
dt &amp;lt;&amp;lt; Begin Data Update;
For Each Row( dt,
	dt:name = Substitute( dt:name, 
		"A", "a",
		"E", "e",
		"I", "i",
		"O", "o",
		"U", "u"
	)
);
dt &amp;lt;&amp;lt; End Data Update;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Lower case vowels." style="width: 564px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/34652i2EA1815005A720A0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Lower case vowels." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Lower case vowels.&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 15:02:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-perform-quot-find-amp-replace-quot-in-specific-a-column/m-p/405901#M65602</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2021-07-30T15:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform "find &amp; replace" in specific a column using JSL script?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-perform-quot-find-amp-replace-quot-in-specific-a-column/m-p/406164#M65635</link>
      <description>Thanks a lot !!</description>
      <pubDate>Mon, 02 Aug 2021 05:54:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-perform-quot-find-amp-replace-quot-in-specific-a-column/m-p/406164#M65635</guid>
      <dc:creator>Adi-B</dc:creator>
      <dc:date>2021-08-02T05:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform "find &amp; replace" in specific a column using JSL script?</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-perform-quot-find-amp-replace-quot-in-specific-a-column/m-p/406711#M65680</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/982"&gt;@Craige_Hales&lt;/a&gt;.&amp;nbsp;Looks like the makings for a good Challenge question.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 19:08:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-perform-quot-find-amp-replace-quot-in-specific-a-column/m-p/406711#M65680</guid>
      <dc:creator>DonMcCormack</dc:creator>
      <dc:date>2021-08-03T19:08:56Z</dc:date>
    </item>
  </channel>
</rss>

