<?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 DateDiff expression in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-datediff-expression/m-p/1138210#M44009</link>
    <description>&lt;P&gt;I utilized the When statement with success.&amp;nbsp; Thank you very much for your assistance!&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jan 2022 00:43:05 GMT</pubDate>
    <dc:creator>BobWheeler</dc:creator>
    <dc:date>2022-01-28T00:43:05Z</dc:date>
    <item>
      <title>Arcade DateDiff expression</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-datediff-expression/m-p/1138127#M44003</link>
      <description>&lt;P&gt;I have inspection dates to symbolize my locations.&amp;nbsp; I was using the expression below and it works fine, but now I need to add another variable.&lt;/P&gt;&lt;P&gt;IIf(DateDiff(now(), $feature.dateauditperformed, 'years') &amp;lt; 1, "Inspected","2/3 Year")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I want those locations inspected within the last year = Current, &amp;gt;1 and &amp;lt;=2 years = Second Year, and everything else = Third year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I've been trying to work with.&amp;nbsp; All I seem to get is "other".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var year = DateDiff(Now(), $feature.dateauditperformed,'years');&lt;/P&gt;&lt;P&gt;if (year &amp;lt;= 1) return 'Current';&lt;BR /&gt;else if (year &amp;gt; 1 &amp;amp;&amp;amp; year &amp;lt;= 2) return 'Second Year';&lt;BR /&gt;else return 'Third Year';&lt;BR /&gt;end&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jan 2022 21:33:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-datediff-expression/m-p/1138127#M44003</guid>
      <dc:creator>BobWheeler</dc:creator>
      <dc:date>2022-01-27T21:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade DateDiff expression</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-datediff-expression/m-p/1138137#M44006</link>
      <description>&lt;P&gt;Keep in mind that your conditions are evaluated in order, so you don't really need to include the "year &amp;gt; 1" on the second condition.&lt;/P&gt;&lt;P&gt;Also, when writing &lt;STRONG&gt;if &lt;/STRONG&gt;statements in Arcade, you need to enclose the following command in brackets. And you don't need to put "end" on there.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var year = DateDiff(Now(), $feature.dateauditperformed,'years');

if (year &amp;lt;= 1){
    return 'Current'
} else if (year &amp;lt;= 2){
    return 'Second Year'
} else {
    return 'Third Year'
}&lt;/LI-CODE&gt;&lt;P&gt;But really, you could also accomplish this with a &lt;STRONG&gt;When&lt;/STRONG&gt; function, too. It's more or less equivalent.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var year = DateDiff(Now(), $feature.dateauditperformed,'years');

return When(year &amp;lt;= 1, 'Current', year &amp;lt;= 2, 'Second Year', 'Third Year');&lt;/LI-CODE&gt;&lt;P&gt;Try either one of those. Do you still get a response of "other"?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jan 2022 21:46:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-datediff-expression/m-p/1138137#M44006</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-01-27T21:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade DateDiff expression</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-datediff-expression/m-p/1138210#M44009</link>
      <description>&lt;P&gt;I utilized the When statement with success.&amp;nbsp; Thank you very much for your assistance!&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 00:43:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-datediff-expression/m-p/1138210#M44009</guid>
      <dc:creator>BobWheeler</dc:creator>
      <dc:date>2022-01-28T00:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade DateDiff expression</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-datediff-expression/m-p/1577391#M63244</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to do a similar thing. First I tried to symbolize it, no success and now I am trying to use the list widget.&lt;/P&gt;&lt;P&gt;I have a list of locations, each have a deadline for the project to finish ($feature.deadline).&lt;BR /&gt;I want to symbolize this in a list widget in the dashboard: deadline within a week, deadline withing a month, deadline within 3 months.&lt;/P&gt;&lt;P&gt;Is any of these even possible?&lt;/P&gt;&lt;P&gt;on the symbology in the map the result was always "else"&amp;nbsp;&lt;/P&gt;&lt;P&gt;on the second in the list does not display nothing.&lt;/P&gt;&lt;P&gt;cheers&lt;/P&gt;&lt;P&gt;P&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2025 14:01:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-datediff-expression/m-p/1577391#M63244</guid>
      <dc:creator>PSGeo</dc:creator>
      <dc:date>2025-01-21T14:01:45Z</dc:date>
    </item>
  </channel>
</rss>

