<?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 If statement for range of dates using Arcade in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/if-statement-for-range-of-dates-using-arcade/m-p/1025708#M38434</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm wanting to use an IF statement symbolize and add another field for Fiscal Year.&amp;nbsp; What I'm trying to do is&amp;nbsp; code that new 'Fiscal Year' field based on a range of dates from an existing date field.&amp;nbsp; Below is what I have, though it is returning all 'N/A' values, so the logical '&amp;amp;&amp;amp;' operator doesn't appear to be selecting the dates properly.&amp;nbsp; I will say too that I'm a novice at programming, so there may be a stupidly easy syntax solution for this, and I will be humbly grateful if there is one!&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if ($feature.Projected_Date_to_Open &amp;gt;= 7/1/2019 &amp;amp;&amp;amp; $feature.Projected_Date_to_Open &amp;lt;= 6/30/2020){&lt;BR /&gt;return 'FY 19/20';&lt;BR /&gt;} else if ($feature.Projected_Date_to_Open &amp;gt;= 7/1/2020 &amp;amp;&amp;amp; $feature.Projected_Date_to_Open &amp;lt;= 6/30/2021) {&lt;BR /&gt;return 'FY 20/21';&lt;BR /&gt;} else if ($feature.Projected_Date_to_Open &amp;gt;= 7/1/2021 &amp;amp;&amp;amp; $feature.Projected_Date_to_Open &amp;lt;= 6/30/2022) {&lt;BR /&gt;return 'FY 21/22';&lt;BR /&gt;} else {&lt;BR /&gt;return 'N/A';&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Thu, 11 Feb 2021 01:44:39 GMT</pubDate>
    <dc:creator>DanielHoffman73</dc:creator>
    <dc:date>2021-02-11T01:44:39Z</dc:date>
    <item>
      <title>If statement for range of dates using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/if-statement-for-range-of-dates-using-arcade/m-p/1025708#M38434</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm wanting to use an IF statement symbolize and add another field for Fiscal Year.&amp;nbsp; What I'm trying to do is&amp;nbsp; code that new 'Fiscal Year' field based on a range of dates from an existing date field.&amp;nbsp; Below is what I have, though it is returning all 'N/A' values, so the logical '&amp;amp;&amp;amp;' operator doesn't appear to be selecting the dates properly.&amp;nbsp; I will say too that I'm a novice at programming, so there may be a stupidly easy syntax solution for this, and I will be humbly grateful if there is one!&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if ($feature.Projected_Date_to_Open &amp;gt;= 7/1/2019 &amp;amp;&amp;amp; $feature.Projected_Date_to_Open &amp;lt;= 6/30/2020){&lt;BR /&gt;return 'FY 19/20';&lt;BR /&gt;} else if ($feature.Projected_Date_to_Open &amp;gt;= 7/1/2020 &amp;amp;&amp;amp; $feature.Projected_Date_to_Open &amp;lt;= 6/30/2021) {&lt;BR /&gt;return 'FY 20/21';&lt;BR /&gt;} else if ($feature.Projected_Date_to_Open &amp;gt;= 7/1/2021 &amp;amp;&amp;amp; $feature.Projected_Date_to_Open &amp;lt;= 6/30/2022) {&lt;BR /&gt;return 'FY 21/22';&lt;BR /&gt;} else {&lt;BR /&gt;return 'N/A';&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 01:44:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/if-statement-for-range-of-dates-using-arcade/m-p/1025708#M38434</guid>
      <dc:creator>DanielHoffman73</dc:creator>
      <dc:date>2021-02-11T01:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for range of dates using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/if-statement-for-range-of-dates-using-arcade/m-p/1025826#M38438</link>
      <description>&lt;P&gt;When you want to compare dates, you have to provide a Date object. Your code would look like this&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if ($feature.Projected_Date_to_Open &amp;gt;= Date(2019,6,1) &amp;amp;&amp;amp; $feature.Projected_Date_to_Open &amp;lt;= Date(2020,5,30){ //months are 0-based, where 0 is January and 11 is December&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 11 Feb 2021 13:56:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/if-statement-for-range-of-dates-using-arcade/m-p/1025826#M38438</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-02-11T13:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for range of dates using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/if-statement-for-range-of-dates-using-arcade/m-p/1025845#M38440</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/420066"&gt;@DanielHoffman73&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;In addition to what&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;mentioned, it is advised that you use fields that contain underscores in a different way. See the corrected code below:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if ($feature["Projected_Date_to_Open"] &amp;gt;= Date(2019, 6, 1) &amp;amp;&amp;amp; $feature["Projected_Date_to_Open"] &amp;lt;= Date(2020, 5, 30)) {
    return 'FY 19/20';
} else if ($feature["Projected_Date_to_Open"] &amp;gt;= Date(2020, 6, 1) &amp;amp;&amp;amp; $feature["Projected_Date_to_Open"] &amp;lt;= Date(2021, 5, 30)) {
    return 'FY 20/21';
} else if ($feature["Projected_Date_to_Open"] &amp;gt;= Date(2021, 6, 1) &amp;amp;&amp;amp; $feature["Projected_Date_to_Open"] &amp;lt;= Date(2022, 5, 30)) {
    return 'FY 21/22';
} else {
    return 'N/A';
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 14:30:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/if-statement-for-range-of-dates-using-arcade/m-p/1025845#M38440</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-02-11T14:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for range of dates using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/if-statement-for-range-of-dates-using-arcade/m-p/1025850#M38442</link>
      <description>&lt;P&gt;Excellent.&amp;nbsp; Thanks Ken and Xander for your quick responses!&amp;nbsp; Totally works now.&amp;nbsp; Good to know about the date formatting and syntax suggestions as well.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 14:40:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/if-statement-for-range-of-dates-using-arcade/m-p/1025850#M38442</guid>
      <dc:creator>DanielHoffman73</dc:creator>
      <dc:date>2021-02-11T14:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: If statement for range of dates using Arcade</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/if-statement-for-range-of-dates-using-arcade/m-p/1025858#M38443</link>
      <description>&lt;P&gt;Glad to help. Don't forget to click the "Accept as Solution" button.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Feb 2021 14:50:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/if-statement-for-range-of-dates-using-arcade/m-p/1025858#M38443</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-02-11T14:50:41Z</dc:date>
    </item>
  </channel>
</rss>

