<?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 Label Expression Not Evaluating Properly in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-label-expression-not-evaluating-properly/m-p/1396793#M58145</link>
    <description>&lt;P&gt;I've accepted this as the solution because it is the most simplistic expression to reach the solution I was aiming for. Not sure how I missed the fact that the number cant be both larger than 337.5 &amp;amp; lower than 22.5, but alas here we are. Thank you!&lt;/P&gt;</description>
    <pubDate>Fri, 15 Mar 2024 20:10:45 GMT</pubDate>
    <dc:creator>MFazio</dc:creator>
    <dc:date>2024-03-15T20:10:45Z</dc:date>
    <item>
      <title>Arcade Label Expression Not Evaluating Properly</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-label-expression-not-evaluating-properly/m-p/1396648#M58129</link>
      <description>&lt;P&gt;I have an expression to convert decimal degrees to display a cardinal direction:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;// Convert degrees to cardinal direction

var wind = $feature.Wind_Dir

When(
  wind &amp;gt;= 337.5 &amp;amp;&amp;amp; wind &amp;lt; 22.5, 'N',
  wind &amp;gt;= 22.5  &amp;amp;&amp;amp; wind &amp;lt; 67.5, 'NE',
  wind &amp;gt;= 67.5  &amp;amp;&amp;amp; wind &amp;lt; 112.5, 'E',
  wind &amp;gt;= 112.5 &amp;amp;&amp;amp; wind &amp;lt; 157.5, 'SE',
  wind &amp;gt;= 157.5 &amp;amp;&amp;amp; wind &amp;lt; 202.5, 'S',
  wind &amp;gt;= 202.5 &amp;amp;&amp;amp; wind &amp;lt; 247.5, 'SW',
  wind &amp;gt;= 247.5 &amp;amp;&amp;amp; wind &amp;lt; 292.5, 'W',
  wind &amp;gt;= 292.5 &amp;amp;&amp;amp; wind &amp;lt; 337.5, 'NW',
  "N/A"
  )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When the expression is used in the popup, everything evaluates correctly EXCEPT when the value falls in the North category... I'm not sure what I'm overlooking here. Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 16:23:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-label-expression-not-evaluating-properly/m-p/1396648#M58129</guid>
      <dc:creator>MFazio</dc:creator>
      <dc:date>2024-03-15T16:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Label Expression Not Evaluating Properly</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-label-expression-not-evaluating-properly/m-p/1396651#M58130</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/675570"&gt;@MFazio&lt;/a&gt;&lt;/P&gt;&lt;P&gt;It may be better to try and check 337.5 to 360 and 0 to 22.5 rather than what you have now, I can see that being an issue since it will not satisfy that initial condition with any number between as it is checking for a number greater than 337.5 and also being less than 22.5, here is this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;// Convert degrees to cardinal direction

var wind = $feature.Wind_Dir;

When(
  (wind &amp;gt;= 337.5 &amp;amp;&amp;amp; wind &amp;lt; 360) || (wind &amp;gt;= 0 &amp;amp;&amp;amp; wind &amp;lt; 22.5), 'N',
  wind &amp;gt;= 22.5 &amp;amp;&amp;amp; wind &amp;lt; 67.5, 'NE',
  wind &amp;gt;= 67.5 &amp;amp;&amp;amp; wind &amp;lt; 112.5, 'E',
  wind &amp;gt;= 112.5 &amp;amp;&amp;amp; wind &amp;lt; 157.5, 'SE',
  wind &amp;gt;= 157.5 &amp;amp;&amp;amp; wind &amp;lt; 202.5, 'S',
  wind &amp;gt;= 202.5 &amp;amp;&amp;amp; wind &amp;lt; 247.5, 'SW',
  wind &amp;gt;= 247.5 &amp;amp;&amp;amp; wind &amp;lt; 292.5, 'W',
  wind &amp;gt;= 292.5 &amp;amp;&amp;amp; wind &amp;lt; 337.5, 'NW',
  'N/A'
)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 15 Mar 2024 16:32:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-label-expression-not-evaluating-properly/m-p/1396651#M58130</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2024-03-15T16:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Label Expression Not Evaluating Properly</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-label-expression-not-evaluating-properly/m-p/1396674#M58136</link>
      <description>&lt;P&gt;Your problem in the first line of the When function is a wind can't be both (&amp;amp;&amp;amp;) greater than 337.5 and 22.5. You want to check if it's greater OR (||) less than those values. An easier way to write that expression is&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var wind = $feature.Wind_Dir;

When(
  wind &amp;lt; 22.5, 'N',
  wind &amp;lt; 67.5, 'NE',
  wind &amp;lt; 112.5, 'E',
  wind &amp;lt; 157.5, 'SE',
  wind &amp;lt; 202.5, 'S',
  wind &amp;lt; 247.5, 'SW',
  wind &amp;lt; 292.5, 'W',
  wind &amp;lt; 337.5, 'NW',
  wind &amp;lt; 360, 'N',
  'NA'
);&lt;/LI-CODE&gt;&lt;P&gt;If the function doesn't evaluate the first line as true, then it moves to the second line. For example, if the wind is 30, it fails the first check and moves on to the second. You don't need to check if is greater than 22.4 and less than 67.5 since it already verified that it's greater than 22.5.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 17:11:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-label-expression-not-evaluating-properly/m-p/1396674#M58136</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2024-03-15T17:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Label Expression Not Evaluating Properly</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-label-expression-not-evaluating-properly/m-p/1396793#M58145</link>
      <description>&lt;P&gt;I've accepted this as the solution because it is the most simplistic expression to reach the solution I was aiming for. Not sure how I missed the fact that the number cant be both larger than 337.5 &amp;amp; lower than 22.5, but alas here we are. Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2024 20:10:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-label-expression-not-evaluating-properly/m-p/1396793#M58145</guid>
      <dc:creator>MFazio</dc:creator>
      <dc:date>2024-03-15T20:10:45Z</dc:date>
    </item>
  </channel>
</rss>

