<?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: Find and replace data which contain certain value range in specific column in JSL in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Find-and-replace-data-which-contain-certain-value-range-in/m-p/611914#M81221</link>
    <description>&lt;P&gt;I am assuming that you want all values above 1000 converted to 99, if so, the below script will do this more efficiently than using a For Each Row()&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Data Table( "studentmark" );

headerList = dt &amp;lt;&amp;lt; get column names( string );

For( i = 1, i &amp;lt;= N Items( headerList ), i++,
	If( Contains( headerList[i], "mark" ),
		theRows = dt &amp;lt;&amp;lt; get rows where( As Column( headerList[i] ) &amp;gt; 1000 );
		If( Length( theRows ) &amp;gt; 0,
			Column( headerList[i] )[theRows] = 99
		);
	);	
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 14 Mar 2023 17:57:48 GMT</pubDate>
    <dc:creator>txnelson</dc:creator>
    <dc:date>2023-03-14T17:57:48Z</dc:date>
    <item>
      <title>Find and replace data which contain certain value range in specific column in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Find-and-replace-data-which-contain-certain-value-range-in/m-p/611866#M81218</link>
      <description>&lt;P&gt;Hi! all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to find and replace data which contain certain value range in specific column by using jmp script&lt;/P&gt;&lt;P&gt;However, the code didn't take effect&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code that want to loop through the data in "mark" column and look for value that more than 1000 and substitute with 99&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Data Table( "studentmark" );

headerList = dt &amp;lt;&amp;lt; get column names( string );

For( i = 1, i &amp;lt;= N Items( headerList ), i++,

	If(  Contains(headerList[i], "mark"), 
	dt &amp;lt;&amp;lt; Begin Data Update;
	For Each Row( dt, As Column( dt, headerList[i]) = Substitute( As Column( dt, headerList[i]) &amp;gt; 1000 , 99 ));
	dt &amp;lt;&amp;lt; End Data Update;
	);	
	
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Does anyone knows what's went wrong with the code?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate the helps. Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 16:29:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Find-and-replace-data-which-contain-certain-value-range-in/m-p/611866#M81218</guid>
      <dc:creator>LipYeong</dc:creator>
      <dc:date>2023-06-08T16:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: Find and replace data which contain certain value range in specific column in JSL</title>
      <link>https://community.jmp.com/t5/Discussions/Find-and-replace-data-which-contain-certain-value-range-in/m-p/611914#M81221</link>
      <description>&lt;P&gt;I am assuming that you want all values above 1000 converted to 99, if so, the below script will do this more efficiently than using a For Each Row()&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Data Table( "studentmark" );

headerList = dt &amp;lt;&amp;lt; get column names( string );

For( i = 1, i &amp;lt;= N Items( headerList ), i++,
	If( Contains( headerList[i], "mark" ),
		theRows = dt &amp;lt;&amp;lt; get rows where( As Column( headerList[i] ) &amp;gt; 1000 );
		If( Length( theRows ) &amp;gt; 0,
			Column( headerList[i] )[theRows] = 99
		);
	);	
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Mar 2023 17:57:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Find-and-replace-data-which-contain-certain-value-range-in/m-p/611914#M81221</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-03-14T17:57:48Z</dc:date>
    </item>
  </channel>
</rss>

