<?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 Use Arcade to Filter FeatureSet by Current Date in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/use-arcade-to-filter-featureset-by-current-date/m-p/1573886#M63050</link>
    <description>&lt;P&gt;I have two datasets that I am joining where one is the primary dataset of features with geometry and the other is stemmed from a Survey123 form that contains entries for active restrictions to the primary dataset (parking related for our municipal airport).&lt;/P&gt;&lt;P&gt;I use the FeatureSetByPortalItem function in Arcade to pull in all features for the primary feature and the survey feature. I want to use the Filter function to filter the survey feature to only retain active restrictions based on the rest_start and rest_end date fields that indicate when the restriction is to begin and end. I know that in the Filter function you use SQL syntax to apply the filter you want but I can't seem to get mine to work. What am I doing wrong here? See below a snippet of the code used to pull in the feature set and the end of the filter function where I try to apply the SQL query. It seems to throw an error related to the GETDATE().&lt;/P&gt;&lt;P&gt;-------------------------------------&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;p&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;'&amp;lt;OUR AGOL URL&amp;gt;'&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;restrictions&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;Filter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FeatureSetByPortalItem&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Portal&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;p&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;'&amp;lt;ITEM ID&amp;gt;'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;, [&lt;/SPAN&gt;&lt;SPAN&gt;'aircraftparkingnames'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'rest_type'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'rest_type_other'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'rest_name'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'rest_start'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'rest_end'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'rest_desc'&lt;/SPAN&gt;&lt;SPAN&gt;], &lt;/SPAN&gt;&lt;SPAN&gt;false&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;'rest_start &amp;lt;= GETDATE() AND rest_end &amp;gt; GETDATE()'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Thu, 09 Jan 2025 13:50:46 GMT</pubDate>
    <dc:creator>CameronLacelle</dc:creator>
    <dc:date>2025-01-09T13:50:46Z</dc:date>
    <item>
      <title>Use Arcade to Filter FeatureSet by Current Date</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/use-arcade-to-filter-featureset-by-current-date/m-p/1573886#M63050</link>
      <description>&lt;P&gt;I have two datasets that I am joining where one is the primary dataset of features with geometry and the other is stemmed from a Survey123 form that contains entries for active restrictions to the primary dataset (parking related for our municipal airport).&lt;/P&gt;&lt;P&gt;I use the FeatureSetByPortalItem function in Arcade to pull in all features for the primary feature and the survey feature. I want to use the Filter function to filter the survey feature to only retain active restrictions based on the rest_start and rest_end date fields that indicate when the restriction is to begin and end. I know that in the Filter function you use SQL syntax to apply the filter you want but I can't seem to get mine to work. What am I doing wrong here? See below a snippet of the code used to pull in the feature set and the end of the filter function where I try to apply the SQL query. It seems to throw an error related to the GETDATE().&lt;/P&gt;&lt;P&gt;-------------------------------------&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;p&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;'&amp;lt;OUR AGOL URL&amp;gt;'&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;restrictions&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;Filter&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FeatureSetByPortalItem&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Portal&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;p&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;'&amp;lt;ITEM ID&amp;gt;'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;, [&lt;/SPAN&gt;&lt;SPAN&gt;'aircraftparkingnames'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'rest_type'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'rest_type_other'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'rest_name'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'rest_start'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'rest_end'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'rest_desc'&lt;/SPAN&gt;&lt;SPAN&gt;], &lt;/SPAN&gt;&lt;SPAN&gt;false&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;'rest_start &amp;lt;= GETDATE() AND rest_end &amp;gt; GETDATE()'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 09 Jan 2025 13:50:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/use-arcade-to-filter-featureset-by-current-date/m-p/1573886#M63050</guid>
      <dc:creator>CameronLacelle</dc:creator>
      <dc:date>2025-01-09T13:50:46Z</dc:date>
    </item>
    <item>
      <title>Re: Use Arcade to Filter FeatureSet by Current Date</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/use-arcade-to-filter-featureset-by-current-date/m-p/1573958#M63057</link>
      <description>&lt;P&gt;I'd swap out GETDATE() for Now()&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;var p = '&amp;lt;OUR AGOL URL&amp;gt;';

var restrictions = Filter(
    FeatureSetByPortalItem(
        Portal(p),
        '&amp;lt;ITEM ID&amp;gt;',
        0,
        ['aircraftparkingnames', 'rest_type', 'rest_type_other', 'rest_name', 'rest_start', 'rest_end', 'rest_desc'],
        false
    ),
    'rest_start &amp;lt;= Now() AND rest_end &amp;gt; Now()'
);&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 09 Jan 2025 15:48:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/use-arcade-to-filter-featureset-by-current-date/m-p/1573958#M63057</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2025-01-09T15:48:36Z</dc:date>
    </item>
    <item>
      <title>Re: Use Arcade to Filter FeatureSet by Current Date</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/use-arcade-to-filter-featureset-by-current-date/m-p/1573959#M63058</link>
      <description>&lt;P&gt;Thanks, I've used Now() for other things in arcade (if statements and such) but since I've read the filter function uses SQL syntax I thought I had to use GETDATE().&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Appreciate the response &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2025 15:52:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/use-arcade-to-filter-featureset-by-current-date/m-p/1573959#M63058</guid>
      <dc:creator>CameronLacelle</dc:creator>
      <dc:date>2025-01-09T15:52:55Z</dc:date>
    </item>
  </channel>
</rss>

