<?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: Arcade IF statements with AND or OR in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-if-statements-with-and-or-or/m-p/563072#M28368</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The best way to use AND in Arcade is the following: "&amp;amp;&amp;amp;" input &amp;amp;&amp;amp; between the expressions like the following example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If (($feature.GlobalID != Null) &amp;amp;&amp;amp; ($feature.TYPE == "Conduit")){&lt;BR /&gt;Return "CONDUIT::" + Upper(right(split($feature.GLOBALID,"-")[0],8))&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above is a script that looks at data from two fields and returns a unique ID for an element&amp;nbsp;based on the entries of that Field.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Nov 2020 19:49:42 GMT</pubDate>
    <dc:creator>BrandonBiron</dc:creator>
    <dc:date>2020-11-10T19:49:42Z</dc:date>
    <item>
      <title>Arcade IF statements with AND or OR</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-if-statements-with-and-or-or/m-p/563067#M28363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've searched and searched but either couldn't figure out how to word my question or it hasn't been asked. Basically, is it possible to use AND or OR in an IF statement so I don't have to make a bunch of expressions? Especially useful when it comes to pop-ups.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example (very generalized):&lt;/P&gt;&lt;P&gt;I want to display a pop-up that shows one of three things; A, AB, or None. Naturally I would think of it like a definition query,&lt;/P&gt;&lt;P&gt;= IIf($feature["OCC_ELUM"] == 0, " ", "A")&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;= IIf($feature["OCC_ELUM"] == 1, " ", "AB")&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;= IIf($feature["OCC_ELUM"] == 2, " ", "None")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But this isn't the case. Any help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2018 19:45:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-if-statements-with-and-or-or/m-p/563067#M28363</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2018-07-23T19:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade IF statements with AND or OR</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-if-statements-with-and-or-or/m-p/563068#M28364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bryan,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like this might work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if ( $feature[&lt;SPAN style="background-color: #ffffff;"&gt;"OCC_ELUM"&lt;/SPAN&gt;] == 0) {&lt;BR /&gt; return "A"&lt;BR /&gt;}&lt;BR /&gt;else if ( $feature[&lt;SPAN style="background-color: #ffffff;"&gt;"OCC_ELUM"&lt;/SPAN&gt;] == 1) {&lt;BR /&gt; return "AB"&lt;BR /&gt;}&lt;BR /&gt;&lt;SPAN&gt;else if ( $feature[&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff;"&gt;"OCC_ELUM"&lt;/SPAN&gt;&lt;SPAN&gt;] == 2) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return "None"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can add in as many 'else if's as needed. If you needed, you could finish it with 'else' to catch any other values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if ( $feature[&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff;"&gt;"OCC_ELUM"&lt;/SPAN&gt;&lt;SPAN&gt;] == 0) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return "A"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else if ( $feature[&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff;"&gt;"OCC_ELUM"&lt;/SPAN&gt;&lt;SPAN&gt;] == 1) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return "AB"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else if ( $feature[&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff;"&gt;"OCC_ELUM"&lt;/SPAN&gt;&lt;SPAN&gt;] == 2) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return "None"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;else {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;return "No Values"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Carmel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jul 2018 12:42:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-if-statements-with-and-or-or/m-p/563068#M28364</guid>
      <dc:creator>CarmelConnolly</dc:creator>
      <dc:date>2018-07-24T12:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade IF statements with AND or OR</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-if-statements-with-and-or-or/m-p/563069#M28365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or use Decode()&lt;/P&gt;&lt;P&gt;Decode($feature.OCC_ELUM,1,"AB",2,"None","No Values")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jun 2019 20:32:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-if-statements-with-and-or-or/m-p/563069#M28365</guid>
      <dc:creator>DavidAllen</dc:creator>
      <dc:date>2019-06-11T20:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade IF statements with AND or OR</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-if-statements-with-and-or-or/m-p/563070#M28366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, this article helped to solve a big problem and many thanks. How can we replace '_' that contains in values of a field with space?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wali&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Dec 2019 10:03:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-if-statements-with-and-or-or/m-p/563070#M28366</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-12-24T10:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade IF statements with AND or OR</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-if-statements-with-and-or-or/m-p/563071#M28367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/348028"&gt;Sayed Wali&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I you want to replace "_" by " " you can use the function Replace. Something like this:&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; result &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Replace&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;YourText&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"_"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;" "&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Dec 2019 13:53:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-if-statements-with-and-or-or/m-p/563071#M28367</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2019-12-24T13:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade IF statements with AND or OR</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-if-statements-with-and-or-or/m-p/563072#M28368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The best way to use AND in Arcade is the following: "&amp;amp;&amp;amp;" input &amp;amp;&amp;amp; between the expressions like the following example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If (($feature.GlobalID != Null) &amp;amp;&amp;amp; ($feature.TYPE == "Conduit")){&lt;BR /&gt;Return "CONDUIT::" + Upper(right(split($feature.GLOBALID,"-")[0],8))&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above is a script that looks at data from two fields and returns a unique ID for an element&amp;nbsp;based on the entries of that Field.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Nov 2020 19:49:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-if-statements-with-and-or-or/m-p/563072#M28368</guid>
      <dc:creator>BrandonBiron</dc:creator>
      <dc:date>2020-11-10T19:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade IF statements with AND or OR</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-if-statements-with-and-or-or/m-p/1099551#M42220</link>
      <description>&lt;P&gt;How would this work if I have two different fields that can signify the same thing?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I am trying to show:&amp;nbsp;&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Smoked&lt;/STRONG&gt; -&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P&gt;Smoke = True OR Connected to Sanitary = True&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;EM&gt;DomainName($feature,"test_type") == 'Smoke Test'&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;&lt;EM&gt;DomainName($feature,"other_testresult")=='Connected to Sanitary'&lt;/EM&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Smoked w/ Problems&lt;/STRONG&gt;&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P&gt;Smoked with Problems = True OR No Show = True&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;EM&gt;DomainName($feature,"smoke_result") == 'Smoke with P&lt;/EM&gt;roblems'&lt;/LI&gt;&lt;LI&gt;DomainName($feature,"other_testresult")=='No Show'&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Test Failed&lt;/STRONG&gt;&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P&gt;(No Smoke = True AND (SmokeProblem &amp;lt;&amp;gt; Vacant Lot OR SmokeProblem &amp;lt;&amp;gt; Parking Lot)) OR Connected to Storm = True&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;DomainName($feature,"smoke_result")=='No Smoke'&lt;/LI&gt;&lt;LI&gt;$feature["vacant_lot"] == 0&lt;/LI&gt;&lt;LI&gt;$feature["parking_lot"] == 0&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Septic&lt;/STRONG&gt;&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P&gt;Septic = True&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;DomainName($feature,"test_type") == 'Septic System'&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Vacant/Parking Lot&lt;/STRONG&gt;&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;P&gt;SmokeProblem &amp;lt;&amp;gt; Vacant Lot OR SmokeProblem &amp;lt;&amp;gt; Parking Lot&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;$feature["vacant_lot"] == 1&lt;/LI&gt;&lt;LI&gt;$feature["parking_lot"] == 1&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;//Smoked
if ( DomainName($feature,"test_type") == 'Smoke Test') 
{
if ( DomainName($feature,"other_testresult")=='Connected to Sanitary')
{
return "Smoked"
}
}
//Septic
else if ( DomainName($feature,"test_type") == 'Septic System')
{
return "Septic"
}
//Smoked with Problems
else if ( DomainName($feature,"smoke_result") == 'Smoke with Problems') 
{
if (DomainName($feature,"other_testresult")=='No Show')
{
return "Smoked with Problems"
}
}
//Test Failed
else if (DomainName($feature,"smoke_result")=='No Smoke')
{
if ( $feature["vacant_lot"] == 0) 
{
if ( $feature["parking_lot"] == 0)
{
return "Test Failed"
}
}
}
//Vacant/Parking Lot
else if ( $feature["vacant_lot"] == 1) 
{
if ( $feature["parking_lot"] == 1) 
{
return "Vacant/Parking Lot"
}
}
else {

return "No Values"

}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I have come up with so far, but it is only returning "No Values" . I think this has to do with the fact that I am trying to get two different fields to = the same thing. Has anyone done this before that can help me out?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance,&lt;/P&gt;&lt;P&gt;Vanessa&lt;/P&gt;</description>
      <pubDate>Fri, 17 Sep 2021 20:59:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-if-statements-with-and-or-or/m-p/1099551#M42220</guid>
      <dc:creator>VanessaSimps</dc:creator>
      <dc:date>2021-09-17T20:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade IF statements with AND or OR</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-if-statements-with-and-or-or/m-p/1158584#M45186</link>
      <description>&lt;P&gt;There is a technical article on this subject in the Esri Knowledge Base:&amp;nbsp;&lt;A href="https://support.esri.com/en/Technical-Article/000027277" target="_self"&gt;&lt;SPAN&gt;How To: Use multiple Arcade IF statements in ArcGIS Online&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 20:50:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-if-statements-with-and-or-or/m-p/1158584#M45186</guid>
      <dc:creator>rich6626</dc:creator>
      <dc:date>2022-03-28T20:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade IF statements with AND or OR</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-if-statements-with-and-or-or/m-p/1484575#M59543</link>
      <description>&lt;P&gt;Use &amp;amp;&amp;amp; for AND conditions, use || for OR conditions. For instance you can use an expression like this in Arcade (OR):&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;if ($feature.evaluation_type == "01" || isEmpty($feature.evaluation_type)) {
       return 0;
 }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 04 Jun 2024 17:13:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-if-statements-with-and-or-or/m-p/1484575#M59543</guid>
      <dc:creator>ChristianCordova</dc:creator>
      <dc:date>2024-06-04T17:13:53Z</dc:date>
    </item>
  </channel>
</rss>

