<?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: if &amp;quot;compare&amp;quot; column value&amp;gt;100%, then change the value to 100%, if &amp;lt;=100%, then keep the value no change in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/if-quot-compare-quot-column-value-is-greater-than-100-then/m-p/271720#M52893</link>
    <description>&lt;BR /&gt;for the first method: if( :weight / :height &amp;gt; 1, 1); ------This is update all the values which exceed 100% successful. But change the number less than 100% to "." which should keep no change. don't know how to improve this script.&lt;BR /&gt;&lt;BR /&gt;For the second method:For Each Row( If( :ratio &amp;gt; 1, :ratio = 1 ) ); works well. thank you so much.</description>
    <pubDate>Wed, 10 Jun 2020 07:32:18 GMT</pubDate>
    <dc:creator>Theresa</dc:creator>
    <dc:date>2020-06-10T07:32:18Z</dc:date>
    <item>
      <title>if "compare" column value is greater than 100%, then change the value to 100%, if less than or equal to 100%, then keep the value no change</title>
      <link>https://community.jmp.com/t5/Discussions/if-quot-compare-quot-column-value-is-greater-than-100-then/m-p/269482#M52465</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

New Column( "Compare", Numeric, "Continuous", Format( "Percent", 12, 0 ), Formula( :weight / :height ) );

//change the value on position of :weight[2] to 59. But seems not work. could you help edit the script on this place?


dt:weight[2] &amp;lt;&amp;lt; Set Values( 58 );


// I hope realize if the column "compare" result &amp;gt;100%, then output 100%, if &amp;lt;100% then keep the value no change. then how to edit script below? If( :Compare&amp;gt;100%,100%, no change);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 23:27:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/if-quot-compare-quot-column-value-is-greater-than-100-then/m-p/269482#M52465</guid>
      <dc:creator>Theresa</dc:creator>
      <dc:date>2023-06-09T23:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: if "compare" column value&gt;100%, then change the value to 100%, if &lt;=100%, then keep the value no change</title>
      <link>https://community.jmp.com/t5/Discussions/if-quot-compare-quot-column-value-is-greater-than-100-then/m-p/269486#M52466</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
New Column( "Compare",
	Numeric,
	"Continuous",
	Format( "Percent", 12, 0 ),
	Formula( :weight / :height )
);

// Changing the 2nd rows value for Weight to 59 will work with
// a simple assignment statement
dt:weight[2] = 59;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// One can not change a cell in a formula column,
// unless you change the complete formula

dt:compare &amp;lt;&amp;lt; set formula(
		:weight / :height;
		if( :weight / :height &amp;gt; 1, 1)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Probably the method that I use most often, is to Delete the formula from a&amp;nbsp; column that was created using a formula.&amp;nbsp; Deleting the formula, converts the column into a normal static column, keeping all of the values.&amp;nbsp; You can then just make the changes you need, using standard assignment statements.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
New Column( "ratio",
	Numeric,
	"Continuous",
	Format( "Percent", 12, 0 ),
	Formula( :weight / :height )
);
dt &amp;lt;&amp;lt; run formulas;

dt:ratio &amp;lt;&amp;lt; delete formula;

For Each Row( If( :ratio &amp;gt; 1, :ratio = 1 ) )
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 May 2020 08:52:31 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/if-quot-compare-quot-column-value-is-greater-than-100-then/m-p/269486#M52466</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-05-29T08:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: if "compare" column value&gt;100%, then change the value to 100%, if &lt;=100%, then keep the value no change</title>
      <link>https://community.jmp.com/t5/Discussions/if-quot-compare-quot-column-value-is-greater-than-100-then/m-p/271720#M52893</link>
      <description>&lt;BR /&gt;for the first method: if( :weight / :height &amp;gt; 1, 1); ------This is update all the values which exceed 100% successful. But change the number less than 100% to "." which should keep no change. don't know how to improve this script.&lt;BR /&gt;&lt;BR /&gt;For the second method:For Each Row( If( :ratio &amp;gt; 1, :ratio = 1 ) ); works well. thank you so much.</description>
      <pubDate>Wed, 10 Jun 2020 07:32:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/if-quot-compare-quot-column-value-is-greater-than-100-then/m-p/271720#M52893</guid>
      <dc:creator>Theresa</dc:creator>
      <dc:date>2020-06-10T07:32:18Z</dc:date>
    </item>
  </channel>
</rss>

