<?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 How to combine an IF statement inside a for loop in Arcade ?  in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/how-to-combine-an-if-statement-inside-a-for-loop/m-p/29685#M1486</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an array of numbers (around 800 numbers) var mylist = [604703,607006,607606,607607,.................]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and I have a &lt;STRONG&gt;Number&lt;/STRONG&gt; datatype field in one of my layers. I want to see if the data inside this field match any of the numbers in mylist? and when it does it will say for example " Matched " if does not " No Match".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp;&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/498380_mylist.PNG" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Jun 2020 20:29:02 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2020-06-30T20:29:02Z</dc:date>
    <item>
      <title>How to combine an IF statement inside a for loop in Arcade ?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-combine-an-if-statement-inside-a-for-loop/m-p/29685#M1486</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an array of numbers (around 800 numbers) var mylist = [604703,607006,607606,607607,.................]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and I have a &lt;STRONG&gt;Number&lt;/STRONG&gt; datatype field in one of my layers. I want to see if the data inside this field match any of the numbers in mylist? and when it does it will say for example " Matched " if does not " No Match".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp;&lt;IMG alt="" class="jive-emoji image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/498380_mylist.PNG" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2020 20:29:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-combine-an-if-statement-inside-a-for-loop/m-p/29685#M1486</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-06-30T20:29:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine an IF statement inside a for loop in Arcade ?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-combine-an-if-statement-inside-a-for-loop/m-p/29686#M1487</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use &lt;A href="https://developers.arcgis.com/arcade/function-reference/data_functions/#indexof" rel="nofollow noopener noreferrer" target="_blank"&gt;IndexOf&lt;/A&gt; to determine whether an item is found in array&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;IndexOf&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;myList&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;$Number&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Matched"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"No Match"&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;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:11:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-combine-an-if-statement-inside-a-for-loop/m-p/29686#M1487</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-10T21:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine an IF statement inside a for loop in Arcade ?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-combine-an-if-statement-inside-a-for-loop/m-p/29687#M1488</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not that this is any better than Ken's answer, just a slightly different code structure:&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;IIf(IndexOf(myList,feature.$Number) &amp;gt; -1, "Matched", "No Match");&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, 30 Jun 2020 22:46:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-combine-an-if-statement-inside-a-for-loop/m-p/29687#M1488</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-06-30T22:46:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine an IF statement inside a for loop in Arcade ?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-combine-an-if-statement-inside-a-for-loop/m-p/29688#M1489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Thank you so much&amp;nbsp;@ken buja&amp;nbsp;!&lt;/STRONG&gt; it worked !!&amp;nbsp;&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&amp;nbsp; I was able to use it in the configure popups and in symbology expressions !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2020 14:10:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-combine-an-if-statement-inside-a-for-loop/m-p/29688#M1489</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-07-01T14:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine an IF statement inside a for loop in Arcade ?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-combine-an-if-statement-inside-a-for-loop/m-p/29689#M1490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Both @ ken Buja and Joshua bixby's code worked with me !!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2020 14:11:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-combine-an-if-statement-inside-a-for-loop/m-p/29689#M1490</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-07-01T14:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine an IF statement inside a for loop in Arcade ?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/how-to-combine-an-if-statement-inside-a-for-loop/m-p/29690#M1491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you @Joshua Bixby ! It worked !&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2020 14:12:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/how-to-combine-an-if-statement-inside-a-for-loop/m-p/29690#M1491</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-07-01T14:12:31Z</dc:date>
    </item>
  </channel>
</rss>

