<?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 / When statement in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-when-statement/m-p/402266#M17867</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm still learning Arcade myself, but it looks to me like you're definitely missing an &lt;EM&gt;open&lt;/EM&gt; parenthesis on line 3. Try &lt;STRONG&gt;when((day_ = 1), "Sunday", "n/a")&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Feb 2019 19:01:31 GMT</pubDate>
    <dc:creator>NickDierks1</dc:creator>
    <dc:date>2019-02-06T19:01:31Z</dc:date>
    <item>
      <title>Arcade / When statement</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-when-statement/m-p/402265#M17866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, so I have an Arcade script that is looking for a closed parenthesis, but for the life of me, I can't figure out where. I've added 2, just for illustration - but neither seems to work on line 3. Admittedly, I don't do a lot of Arcade, so any help appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/436676_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Feb 2019 17:57:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-when-statement/m-p/402265#M17866</guid>
      <dc:creator>RichardQuodomine1</dc:creator>
      <dc:date>2019-02-06T17:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade / When statement</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-when-statement/m-p/402266#M17867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm still learning Arcade myself, but it looks to me like you're definitely missing an &lt;EM&gt;open&lt;/EM&gt; parenthesis on line 3. Try &lt;STRONG&gt;when((day_ = 1), "Sunday", "n/a")&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Feb 2019 19:01:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-when-statement/m-p/402266#M17867</guid>
      <dc:creator>NickDierks1</dc:creator>
      <dc:date>2019-02-06T19:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade / When statement</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-when-statement/m-p/402267#M17868</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/272597" target="_blank"&gt;Richard Quodomine&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I see a couple of errors in the expression and because of that I'm not entirely clear what you are trying to do. Let's include the code after the correction made by&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/321368" target="_blank"&gt;Nick Dierks&lt;/A&gt;&amp;nbsp;to sove the missing parenthesis:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;RetWeekDay&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;text&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; day_ &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; $feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;DAY_OF_WEE&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; DOW &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;When&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;day_ &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="string token"&gt;"Sunday"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"n/a"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    DOW &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; RetWeewkDay&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; RetWeekDay&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;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me list some of the errors:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;on line 1 you define a parameter that is actually an existing function itself. You should avoid that. A complete list of functions can be found here:&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/arcade/function-reference/" title="https://developers.arcgis.com/arcade/function-reference/" rel="nofollow noopener noreferrer" target="_blank"&gt;Arcade Function Reference | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;This parameter is never used, so why define it?&lt;/LI&gt;&lt;LI&gt;On line 3 the function When requires a condition. If you compare day_ with 1, you should use double equal signs, so: day_ == 1&lt;/LI&gt;&lt;LI&gt;On line 4 you replace the value just assigned to DOW with a call to the same function not specifying the parameter (this could potentially result in an infinite loop)&lt;/LI&gt;&lt;LI&gt;On line 5 you return the same function not specifying the parameter which also could result in an infinite loop.&lt;/LI&gt;&lt;LI&gt;When using a function you should call it in order&amp;nbsp;for it to be executed.&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to return the text "Sunday" when your attribute DAY_OF_WEE is 1,&amp;nbsp;and&amp;nbsp; "n/a" in all other cases, you can do something like:&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;$feature&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;DAY_OF_WEE &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;"Sunday"&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;"n/a"&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>Sat, 11 Dec 2021 18:20:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-when-statement/m-p/402267#M17868</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-11T18:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade / When statement</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-when-statement/m-p/402268#M17869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In order:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, thank you both.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second, I did have the double parens up in my first rendition. It kept looking for a close, but I had two.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Third, I should have been clearer, the When statement will go through all 7 days, with a 1 = Sunday, 2 = Monday, etc. I think I whiffed on the ==. I'll get back to all of you with the more complete code, after testing. Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Feb 2019 13:42:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-when-statement/m-p/402268#M17869</guid>
      <dc:creator>RichardQuodomine1</dc:creator>
      <dc:date>2019-02-07T13:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade / When statement</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-when-statement/m-p/402269#M17870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So here it is:&lt;BR /&gt;var day_ = $feature.DAY_OF_WEE;&lt;BR /&gt;var DOW = when((day_ == 1), "Sunday", day_ == 2, "Monday", day_ == 3, "Tuesday", day_ == 4, "Wednesday", day_ == 5, "Thursday", day_ == 6, "Friday", day_ == 7, "Saturday", "n/a");&lt;BR /&gt;DOW&lt;BR /&gt;&lt;BR /&gt;Thanks to both of you for the help. I was just doing a calculated field to get get a good symbology for some data I had. I really appreciate the guidance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Feb 2019 14:36:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-when-statement/m-p/402269#M17870</guid>
      <dc:creator>RichardQuodomine1</dc:creator>
      <dc:date>2019-02-07T14:36:56Z</dc:date>
    </item>
  </channel>
</rss>

