<?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 use use 'not equal to' with logical or in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-use-use-not-equal-to-with-logical-or/m-p/456846#M70208</link>
    <description>&lt;P&gt;If you want to use Or the comparison will get very long and annoying to maintain if the allowed parameter list increases. So I would use !Contains and list of allowed parameters (or associative array):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

myFunc = Function({myParameter},
	{default local},
	ok_parameters = {"Parameter1", "Parameter2"};
	If(!Contains(ok_parameters, myParameter),
		Return(Eval Insert("^myParameter^ not in list ^ok_parameters^"));
	,
		Return(Eval Insert("^myParameter^ in list ^ok_parameters^"));
	);
);

output = myFunc("Parameter1");
Show(output);
output = myFunc("notParameter1");
Show(output);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But you can use or/and also, below is one example (| means or):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

myFunc = Function({myParameter},
	{default local},
	If(!(myParameter == "Parameter1" | myParameter == "Parameter2"),
        return(Eval Insert("output some msg"));
	);
);

output = myFunc("Parameter1");
show(output);
output = myFunc ("notParameter1");
show(output);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 28 Jan 2022 16:18:13 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2022-01-28T16:18:13Z</dc:date>
    <item>
      <title>How to use use 'not equal to' with logical or</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-use-not-equal-to-with-logical-or/m-p/456814#M70204</link>
      <description>&lt;P&gt;In an &lt;EM&gt;if&lt;/EM&gt; statement I would like to do&amp;nbsp;&lt;EM&gt;if&amp;nbsp;&lt;/EM&gt;&lt;EM&gt;myParameter&lt;/EM&gt; &lt;EM&gt;is not equal&amp;nbsp;&lt;/EM&gt;&lt;EM&gt;to either Parameter1 or Parameter2 then return something.&lt;/EM&gt;&amp;nbsp; But my following function is not working as expected.,. Where am I going wrong&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
myFunc =  function ({myParameter}, {default local},
    If (myParameter != Or("Parameter1","Parameter2"), 
        return(Eval Insert("output some msg")),
    );
);
clear log ();
//output = myFunc ("Parameter1");&lt;BR /&gt;output = myFunc ("notParameter1");&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 18:09:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-use-not-equal-to-with-logical-or/m-p/456814#M70204</guid>
      <dc:creator>Neo</dc:creator>
      <dc:date>2023-06-09T18:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to use use 'not equal to' with logical or</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-use-not-equal-to-with-logical-or/m-p/456841#M70207</link>
      <description>&lt;P&gt;You probably mean this (which I like the best)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;if ( (myParameter != Parameter1) &amp;amp; (myParameter != Parameter2) , ...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which is the same as this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;if( ! ( (myParameter == Parameter1) | (myParameter == Parameter2) ), ...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or, the way you were using the or() function, the same as this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;if( !or(myParameter==Parameter1, myParameter==Parameter2), ...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://en.wikipedia.org/wiki/De_Morgan%27s_laws" target="_blank"&gt;https://en.wikipedia.org/wiki/De_Morgan%27s_laws&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, if there are missing values, be sure to handle them with isMissing() because they don't compare like you might expect.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 16:17:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-use-not-equal-to-with-logical-or/m-p/456841#M70207</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2022-01-28T16:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to use use 'not equal to' with logical or</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-use-not-equal-to-with-logical-or/m-p/456846#M70208</link>
      <description>&lt;P&gt;If you want to use Or the comparison will get very long and annoying to maintain if the allowed parameter list increases. So I would use !Contains and list of allowed parameters (or associative array):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

myFunc = Function({myParameter},
	{default local},
	ok_parameters = {"Parameter1", "Parameter2"};
	If(!Contains(ok_parameters, myParameter),
		Return(Eval Insert("^myParameter^ not in list ^ok_parameters^"));
	,
		Return(Eval Insert("^myParameter^ in list ^ok_parameters^"));
	);
);

output = myFunc("Parameter1");
Show(output);
output = myFunc("notParameter1");
Show(output);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But you can use or/and also, below is one example (| means or):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

myFunc = Function({myParameter},
	{default local},
	If(!(myParameter == "Parameter1" | myParameter == "Parameter2"),
        return(Eval Insert("output some msg"));
	);
);

output = myFunc("Parameter1");
show(output);
output = myFunc ("notParameter1");
show(output);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Jan 2022 16:18:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-use-not-equal-to-with-logical-or/m-p/456846#M70208</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-01-28T16:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to use use 'not equal to' with logical or</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-use-use-not-equal-to-with-logical-or/m-p/456855#M70209</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/28235"&gt;@Neo&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; I think the problem might be in how your calling the "or" logical operator. In JSL, the logical or is this character | . So, you'd change the If() statement to something like the following it should work:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

MyFunc = Function( {Myparam},
	If(
		(Myparam != parm1 | Myparam != parm2), Return( Eval Insert( "Output some msg" ) )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Keep in mind the logical only requires one of those two to be true and it will return the result. If Myparam equals one of those, then it still will return the message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps!,&lt;/P&gt;&lt;P&gt;DS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 16:23:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-use-use-not-equal-to-with-logical-or/m-p/456855#M70209</guid>
      <dc:creator>SDF1</dc:creator>
      <dc:date>2022-01-28T16:23:59Z</dc:date>
    </item>
  </channel>
</rss>

