<?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 Arcade Filter by Date in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-by-date/m-p/589188#M29560</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wish to utilize the Filter function in Arcade to only return results between 1/1/2019 and 12/31/2019.&amp;nbsp; I understand the Filter function is&amp;nbsp; Filter(featurerSet, filter) where filter is an SQL text string.&amp;nbsp; The features are stored with a Date/Time field.&amp;nbsp; I am just not understanding the proper SQL commands for working with Date/Time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help or direction to more resources is appreciated.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tagged you&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;‌ because I (a non-programmer) have learned much about Arcade following your numerous examples and help to others on GeoNet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 May 2020 13:52:59 GMT</pubDate>
    <dc:creator>KevinBrown10</dc:creator>
    <dc:date>2020-05-06T13:52:59Z</dc:date>
    <item>
      <title>Arcade Filter by Date</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-by-date/m-p/589188#M29560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wish to utilize the Filter function in Arcade to only return results between 1/1/2019 and 12/31/2019.&amp;nbsp; I understand the Filter function is&amp;nbsp; Filter(featurerSet, filter) where filter is an SQL text string.&amp;nbsp; The features are stored with a Date/Time field.&amp;nbsp; I am just not understanding the proper SQL commands for working with Date/Time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help or direction to more resources is appreciated.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tagged you&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;‌ because I (a non-programmer) have learned much about Arcade following your numerous examples and help to others on GeoNet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Kevin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2020 13:52:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-by-date/m-p/589188#M29560</guid>
      <dc:creator>KevinBrown10</dc:creator>
      <dc:date>2020-05-06T13:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Filter by Date</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-by-date/m-p/589189#M29561</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/people/k.brown" target="_blank"&gt;k.brown&lt;/A&gt;&amp;nbsp;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems that the expression below works (the same format as you would use in Desktop):&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; sql &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"LASTUPDATE BETWEEN date '01/01/2019' and date '12/31/2019'"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; fs &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Filter&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;$layer&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sql&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="token function"&gt;Count&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fs&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:18:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-by-date/m-p/589189#M29561</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-12-12T01:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Filter by Date</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-by-date/m-p/589190#M29562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perfect!&amp;nbsp; This worked for me.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for your quick response.&amp;nbsp; As I stated, I do not have much coding experience but following along with your examples is very helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;KB&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2020 15:21:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-by-date/m-p/589190#M29562</guid>
      <dc:creator>KevinBrown10</dc:creator>
      <dc:date>2020-05-06T15:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Filter by Date</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-by-date/m-p/589191#M29563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A _jive_internal="true" class="jivelink1" href="https://community.esri.com/people/k.brown" title="https://community.esri.com/people/k.brown"&gt;https://community.esri.com/people/k.brown&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm glad it worked!&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2020 19:14:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-by-date/m-p/589191#M29563</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2020-05-06T19:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Filter by Date</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-by-date/m-p/1194013#M47046</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to implement a similar query with arcade and sql, but I can not seem to get it to work when I include variables for my dates:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;var myDate1 &amp;nbsp;= '01/01/2019'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;var myDate2&amp;nbsp; = '12/31/2019'&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;var sql = "LASTUPDATE BETWEEN date 'myDate1' and date 'MyDate2'";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;var fs = Filter($layer, sql);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;return Count(fs);‍‍‍&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks ,&lt;/P&gt;&lt;P&gt;Nana&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 15:50:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-by-date/m-p/1194013#M47046</guid>
      <dc:creator>nanayawosei</dc:creator>
      <dc:date>2022-07-20T15:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Filter by Date</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-by-date/m-p/1217670#M48140</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nana,&lt;/P&gt;&lt;P&gt;You probably figured this out but use the&amp;nbsp;@ symbol in front of your variables to call them inline.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var sql = "LASTUPDATE BETWEEN @myDate1 and @MyDate2";&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 22:31:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-by-date/m-p/1217670#M48140</guid>
      <dc:creator>TomNeer</dc:creator>
      <dc:date>2022-09-29T22:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Filter by Date</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-by-date/m-p/1227867#M48666</link>
      <description>&lt;P&gt;I am using this same filter() in Pro 3.0 with a service published to Server/Federated 10.9.1.&amp;nbsp; My arcade expression works fine in Pro, but it fails in Field Maps and Web AppBuilder with the error on the filter()&amp;nbsp; - Line 4: "Failed to query statistics".&amp;nbsp; Are there any limitations to this, I wouldn't think so.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Holidays table is just a table of holidays, querying of the date column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var t30 = dateadd($feature.initialreport,42,'days')
var t = dateadd($feature.initialreport,0,'days')
//query my date field - dt - on my holidays table
var sqls = "dt BETWEEN @t and @t30";
var fs = count(Filter(FeatureSetbyName($datastore, "SUDOECMS.DBO.Holiday"), sqls))
var dayz = dateadd($feature.initialreport,fs + 42,'days')
return dayz;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 13:00:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/arcade-filter-by-date/m-p/1227867#M48666</guid>
      <dc:creator>TL2</dc:creator>
      <dc:date>2022-11-02T13:00:33Z</dc:date>
    </item>
  </channel>
</rss>

