<?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 ARCADE expression like SQL &amp;quot;IN&amp;quot; in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-like-sql-quot-in-quot/m-p/1035011#M38352</link>
    <description>&lt;P&gt;These seems elementary, but I'm not finding it.&amp;nbsp; I am building an attribute rule using Arcade and I would like to select several different values to meet a criteria.&amp;nbsp; In SQL, I could do:&lt;/P&gt;&lt;P&gt;IF(fieldname&lt;EM&gt;&lt;STRONG&gt; IN&lt;/STRONG&gt;&lt;/EM&gt; ("value1","value2","value3"))&lt;/P&gt;&lt;P&gt;But in ARCADE, I can only seem to do:&lt;/P&gt;&lt;P&gt;IF(fieldname == "value1" || fieldname == "value2" || fieldname == "value3" )&lt;/P&gt;&lt;P&gt;Is there a way to simplify this expression like using the "IN" as in SQL?&lt;/P&gt;</description>
    <pubDate>Wed, 10 Mar 2021 17:22:28 GMT</pubDate>
    <dc:creator>KariBuckvold</dc:creator>
    <dc:date>2021-03-10T17:22:28Z</dc:date>
    <item>
      <title>ARCADE expression like SQL "IN"</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-like-sql-quot-in-quot/m-p/1035011#M38352</link>
      <description>&lt;P&gt;These seems elementary, but I'm not finding it.&amp;nbsp; I am building an attribute rule using Arcade and I would like to select several different values to meet a criteria.&amp;nbsp; In SQL, I could do:&lt;/P&gt;&lt;P&gt;IF(fieldname&lt;EM&gt;&lt;STRONG&gt; IN&lt;/STRONG&gt;&lt;/EM&gt; ("value1","value2","value3"))&lt;/P&gt;&lt;P&gt;But in ARCADE, I can only seem to do:&lt;/P&gt;&lt;P&gt;IF(fieldname == "value1" || fieldname == "value2" || fieldname == "value3" )&lt;/P&gt;&lt;P&gt;Is there a way to simplify this expression like using the "IN" as in SQL?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 17:22:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-like-sql-quot-in-quot/m-p/1035011#M38352</guid>
      <dc:creator>KariBuckvold</dc:creator>
      <dc:date>2021-03-10T17:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: ARCADE expression like SQL "IN"</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-like-sql-quot-in-quot/m-p/1035023#M38355</link>
      <description>&lt;P&gt;You could try something like this?&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var inputArray = ["xyz","abx","bob"];
var bool = Includes(inputArray, "bob");
return bool;&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 10 Mar 2021 17:49:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-like-sql-quot-in-quot/m-p/1035023#M38355</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2021-03-10T17:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: ARCADE expression like SQL "IN"</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-like-sql-quot-in-quot/m-p/1035024#M38356</link>
      <description>&lt;P&gt;You can accomplish this with &lt;A href="https://developers.arcgis.com/arcade/function-reference/data_functions/#includes" target="_self"&gt;&lt;STRONG&gt;Includes&lt;/STRONG&gt;&lt;/A&gt;. Pass an array of values, and if your feature's field is included in the array, it will evaluate as 'true'.&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;var some_list = ['value1', 'value2', 'value3', ... 'valueN']

if(Includes(some_list, $feature.field_name)){
    // It's in!
} else {
    // It's not!
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 17:50:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-like-sql-quot-in-quot/m-p/1035024#M38356</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-03-10T17:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: ARCADE expression like SQL "IN"</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-like-sql-quot-in-quot/m-p/1035025#M38357</link>
      <description>&lt;P&gt;Although Includes will be the path moving forward, it is new in Arcade.&amp;nbsp; If you are working with &amp;lt; 1.12 Arcade, the pattern is to use IndexOf.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 17:52:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-like-sql-quot-in-quot/m-p/1035025#M38357</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-03-10T17:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: ARCADE expression like SQL "IN"</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-like-sql-quot-in-quot/m-p/1035027#M38358</link>
      <description>&lt;P&gt;That's a very good point! Using &lt;STRONG&gt;IndexOf&amp;nbsp;&lt;/STRONG&gt;doesn't return a boolean, so to simply check if it's "in" the list, it would look like this:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;var some_list = ['value1', 'value2', 'value3', ... 'valueN']

if(IndexOf(some_list, $feature.field_name) != -1){
    // It's in!
} else {
    // It's not!
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 17:56:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-like-sql-quot-in-quot/m-p/1035027#M38358</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-03-10T17:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: ARCADE expression like SQL "IN"</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-like-sql-quot-in-quot/m-p/1035098#M38366</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1371"&gt;@JoshuaBixby&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3515"&gt;@DuncanHornby&lt;/a&gt;&amp;nbsp;, I must have an earlier version of ARCADE since only IndexOf worked...and like a charm!&amp;nbsp; Sure wish there was a 'google translate' between programming languages, that should have been much easier to figure out than it was!&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 19:40:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-like-sql-quot-in-quot/m-p/1035098#M38366</guid>
      <dc:creator>KariBuckvold</dc:creator>
      <dc:date>2021-03-10T19:40:42Z</dc:date>
    </item>
  </channel>
</rss>

