<?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: Logical Test to check a range and return True or False in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Logical-Test-to-check-a-range-and-return-True-or-False/m-p/261740#M51260</link>
    <description>&lt;P&gt;Thanks Jeff, great explanation&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Apr 2020 00:07:43 GMT</pubDate>
    <dc:creator>Mickyboy</dc:creator>
    <dc:date>2020-04-28T00:07:43Z</dc:date>
    <item>
      <title>Logical Test to check a range and return True or False</title>
      <link>https://community.jmp.com/t5/Discussions/Logical-Test-to-check-a-range-and-return-True-or-False/m-p/261351#M51158</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;l am trying to check if a value in a cell within a variable lies within a range of values, between 0.50 and 2.0, and if it does fall within that range to return true and if it doesnt return false. i am in the data table, and column info, and typing the following into the edit formula:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;&amp;nbsp;If (0.50 &amp;lt; ( :Name( "P1-R1-D1-L1" ) &amp;gt; 2.0), "True", "False") &lt;BR /&gt;&lt;BR /&gt;// and&amp;nbsp;
&lt;BR /&gt;If (0.50 &amp;lt; ( :Name( "P1-R1-D1-L1" ))|(2.0 &amp;gt; ( :Name( "P1-R1-D1-L1" ), "True", "False"))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but neither is working for me, what am i doing wrong, any help would be greatly appreciated&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 26 Apr 2020 14:47:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Logical-Test-to-check-a-range-and-return-True-or-False/m-p/261351#M51158</guid>
      <dc:creator>Mickyboy</dc:creator>
      <dc:date>2020-04-26T14:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: Logical Test to check a range and return True or False</title>
      <link>https://community.jmp.com/t5/Discussions/Logical-Test-to-check-a-range-and-return-True-or-False/m-p/261354#M51159</link>
      <description>&lt;P&gt;Here is a piece of JSL that creates a column under the specifications you provided&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
dt = New Table( "Example",
	add rows( 20 ),
	New Column( "P1-R1-D1-L1", formula( Random Uniform( 0, 4 ) ) )
);


dt &amp;lt;&amp;lt; New Column( "TorF",
	character,
	formula( If( 0.50 &amp;lt;= :Name( "P1-R1-D1-L1" ) &amp;lt;= 2.0, "True", "False" ) )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 26 Apr 2020 08:43:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Logical-Test-to-check-a-range-and-return-True-or-False/m-p/261354#M51159</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2020-04-26T08:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: Logical Test to check a range and return True or False</title>
      <link>https://community.jmp.com/t5/Discussions/Logical-Test-to-check-a-range-and-return-True-or-False/m-p/261403#M51173</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;gave you a working example but I can explain what you've got wrong in your attempts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;&amp;nbsp;If (0.50 &amp;lt; ( :Name( "P1-R1-D1-L1" ) &amp;gt; 2.0), "True", "False") &lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In this on you're trying a complex comparison that JMP doesn't support, namely a &amp;lt; b &amp;gt; c, i.e. a &lt;STRONG&gt;less than&lt;/STRONG&gt; b &lt;STRONG&gt;greater than&lt;/STRONG&gt; c.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looking in the Formula Editor you can see the complex comparisons that JMP does offer, and that&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;used:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2020-04-26_11-01-47.904.png" style="width: 605px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/23477i6EBF47F83F9569B9/image-dimensions/605x146?v=v2" width="605" height="146" role="button" title="2020-04-26_11-01-47.904.png" alt="2020-04-26_11-01-47.904.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Notice the help text which gives a clue that JMP is a functional language and that these complex operators are really shorthand for the &lt;A href="https://www.jmp.com/support/help/en/15.1/#page/jmp/operators.shtml#" target="_self"&gt;functions Less LessEqual() and LessEqual Less()&lt;/A&gt;. JMP doesn't have a function for the comparison you wanted to make.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the second attempt:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If (0.50 &amp;lt; ( :Name( "P1-R1-D1-L1" ))|(2.0 &amp;gt; ( :Name( "P1-R1-D1-L1" ), "True", "False"))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You've got some more parentheses than needed and they are &amp;nbsp;in the wrong places. Here's a corrected version:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( 0.50 &amp;lt; :Name( "P1-R1-D1-L1" ) | 2.0 &amp;gt; :Name( "P1-R1-D1-L1" ),
	"True",
	"False"
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, let's consider what you're asking for in this logical comparison. You're asking JMP to check whether your column is &lt;STRONG&gt;greater than&lt;/STRONG&gt; .5 &lt;U&gt;&lt;EM&gt;or&lt;/EM&gt;&lt;/U&gt;&amp;nbsp;2.0 is &lt;STRONG&gt;greater than&lt;/STRONG&gt; your column. This will be true for all values of your column. If your column is less than .5, then 2.0 will be greater than your column. If your column is greater than 2.0 then .5 will be less than your column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, you probably want the version that&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;provided, checking to see if your column is within the range .5 to 2.0 using the a &amp;lt; b &amp;lt;= c construct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Apr 2020 15:17:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Logical-Test-to-check-a-range-and-return-True-or-False/m-p/261403#M51173</guid>
      <dc:creator>Jeff_Perkinson</dc:creator>
      <dc:date>2020-04-26T15:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: Logical Test to check a range and return True or False</title>
      <link>https://community.jmp.com/t5/Discussions/Logical-Test-to-check-a-range-and-return-True-or-False/m-p/261740#M51260</link>
      <description>&lt;P&gt;Thanks Jeff, great explanation&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2020 00:07:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Logical-Test-to-check-a-range-and-return-True-or-False/m-p/261740#M51260</guid>
      <dc:creator>Mickyboy</dc:creator>
      <dc:date>2020-04-28T00:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: Logical Test to check a range and return True or False</title>
      <link>https://community.jmp.com/t5/Discussions/Logical-Test-to-check-a-range-and-return-True-or-False/m-p/261741#M51261</link>
      <description>once again thanks txnelson, thanks for all your help, greatly appreciated</description>
      <pubDate>Tue, 28 Apr 2020 00:09:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Logical-Test-to-check-a-range-and-return-True-or-False/m-p/261741#M51261</guid>
      <dc:creator>Mickyboy</dc:creator>
      <dc:date>2020-04-28T00:09:38Z</dc:date>
    </item>
  </channel>
</rss>

