<?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: Utilising date in Arcade expression in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/utilising-date-in-arcade-expression/m-p/1583569#M63578</link>
    <description>&lt;P&gt;You need an expression that determines all three of your symbols at once.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;When(Year(Today())-$feature.year &amp;gt;= 10, '10+', Year(Today())-$feature.year &amp;gt;= 8, '8-10', '&amp;lt;8')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This expression subtracts the feature year from the current year, and if the difference is greater than or equal to 10 then it goes into the 10+ bucket. If it is not, it keeps checking and looks to see if the difference is greater than or equal to 8. If it is, it goes in the 8-10 bucket. If not, it goes into the default bucket of &amp;lt;8.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that I am using $feature.year, but that might be slightly different for you based on your Year field name. The easiest way to determine what that value should be, is to use the variable picker to add it to your expression for you.&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="JenniferAcunto_3-1739194119174.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/124990i8DCAD32D996597B5/image-size/large?v=v2&amp;amp;px=999" role="button" title="JenniferAcunto_3-1739194119174.png" alt="JenniferAcunto_3-1739194119174.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the style panel, you can then assign your desired symbology to those buckets.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="JenniferAcunto_0-1739193746414.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/124989i00DD7F3D345C3B5C/image-size/large?v=v2&amp;amp;px=999" role="button" title="JenniferAcunto_0-1739193746414.png" alt="JenniferAcunto_0-1739193746414.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Feb 2025 13:30:53 GMT</pubDate>
    <dc:creator>JenniferAcunto</dc:creator>
    <dc:date>2025-02-10T13:30:53Z</dc:date>
    <item>
      <title>Utilising date in Arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/utilising-date-in-arcade-expression/m-p/1583534#M63572</link>
      <description>&lt;P&gt;I am creating a map of survey held by my employer. I am trying to use a simple 'traffic-light' symbology pattern to quickly see the survey age. So survey that is ten years or older will be red, 8-10 years amber and less than 8 will be green. The data contains a field called YEAR, contain the year as a number.&lt;/P&gt;&lt;P&gt;I'm attempting to symbolise using an expression but I'm a little overwhelmed by all the date options that appear. So far for my red symbol I have tried the following:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt; &lt;SPAN&gt;YEAR&lt;/SPAN&gt;&lt;SPAN&gt; &amp;gt; (&lt;/SPAN&gt;&lt;SPAN&gt;DateOnly&lt;/SPAN&gt;&lt;SPAN&gt;() + &lt;/SPAN&gt;&lt;SPAN&gt;10&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;But YEAR is highlighted as an unexpected identifier. Any help appreciated.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 10 Feb 2025 09:49:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/utilising-date-in-arcade-expression/m-p/1583534#M63572</guid>
      <dc:creator>MattHouston353</dc:creator>
      <dc:date>2025-02-10T09:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: Utilising date in Arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/utilising-date-in-arcade-expression/m-p/1583540#M63573</link>
      <description>&lt;P&gt;Does this work for you:&lt;/P&gt;&lt;P&gt;if ($feature.year &amp;gt; (Year(Now()) + 10));&lt;/P&gt;&lt;P&gt;This uses the Year() function with the Now() function to get the current year:&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/arcade/function-reference/date_functions/#year" target="_blank"&gt;Date functions | ArcGIS Arcade | Esri Developer&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2025 12:14:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/utilising-date-in-arcade-expression/m-p/1583540#M63573</guid>
      <dc:creator>LeeButler</dc:creator>
      <dc:date>2025-02-10T12:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: Utilising date in Arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/utilising-date-in-arcade-expression/m-p/1583558#M63576</link>
      <description>&lt;P&gt;Hmmm no it still seems to capture all the features; I also had to remove the 'if'.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2025 13:03:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/utilising-date-in-arcade-expression/m-p/1583558#M63576</guid>
      <dc:creator>MattHouston353</dc:creator>
      <dc:date>2025-02-10T13:03:29Z</dc:date>
    </item>
    <item>
      <title>Re: Utilising date in Arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/utilising-date-in-arcade-expression/m-p/1583569#M63578</link>
      <description>&lt;P&gt;You need an expression that determines all three of your symbols at once.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;When(Year(Today())-$feature.year &amp;gt;= 10, '10+', Year(Today())-$feature.year &amp;gt;= 8, '8-10', '&amp;lt;8')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This expression subtracts the feature year from the current year, and if the difference is greater than or equal to 10 then it goes into the 10+ bucket. If it is not, it keeps checking and looks to see if the difference is greater than or equal to 8. If it is, it goes in the 8-10 bucket. If not, it goes into the default bucket of &amp;lt;8.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that I am using $feature.year, but that might be slightly different for you based on your Year field name. The easiest way to determine what that value should be, is to use the variable picker to add it to your expression for you.&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="JenniferAcunto_3-1739194119174.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/124990i8DCAD32D996597B5/image-size/large?v=v2&amp;amp;px=999" role="button" title="JenniferAcunto_3-1739194119174.png" alt="JenniferAcunto_3-1739194119174.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the style panel, you can then assign your desired symbology to those buckets.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="JenniferAcunto_0-1739193746414.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/124989i00DD7F3D345C3B5C/image-size/large?v=v2&amp;amp;px=999" role="button" title="JenniferAcunto_0-1739193746414.png" alt="JenniferAcunto_0-1739193746414.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2025 13:30:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/utilising-date-in-arcade-expression/m-p/1583569#M63578</guid>
      <dc:creator>JenniferAcunto</dc:creator>
      <dc:date>2025-02-10T13:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Utilising date in Arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/utilising-date-in-arcade-expression/m-p/1583580#M63580</link>
      <description>&lt;P&gt;This worked perfectly, thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2025 13:42:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/utilising-date-in-arcade-expression/m-p/1583580#M63580</guid>
      <dc:creator>MattHouston353</dc:creator>
      <dc:date>2025-02-10T13:42:42Z</dc:date>
    </item>
  </channel>
</rss>

