<?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: Can you cast data from string field type to date for use in dashboard date selector in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/can-you-cast-data-from-string-field-type-to-date/m-p/1048906#M39570</link>
    <description>&lt;P&gt;Unfortunately, you can't get Arcade to work like that in the dashboard. A date selector is "layer agnostic", so to speak, and can't work with non-attribute data, as it is essentially just submitting an SQL query to the feature service.&lt;/P&gt;&lt;P&gt;If you watch the network traffic on your browser, you can see it happen:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1618869419607.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/11283iFF93E01DAAB70520/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1618869419607.png" alt="jcarlson_0-1618869419607.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Picking that option sends this to request (relevant part bolded):&lt;/P&gt;&lt;PRE&gt;{"GET":&lt;BR /&gt;  {&lt;BR /&gt;    "scheme":"https",&lt;BR /&gt;    "host":"services6.arcgis.com",&lt;BR /&gt;    "filename":"/U1zX3Wx8hhY7Gb30/arcgis/rest/services/Sales_Hosted/FeatureServer/0/query",&lt;BR /&gt;    "query":{&lt;BR /&gt;      "f":"json",&lt;BR /&gt;      "cacheHint":"true",&lt;BR /&gt;      "groupByFieldsForStatistics":"sale_year,valid_sale",&lt;BR /&gt;      "orderByFields":"sale_year ASC",&lt;BR /&gt;      "outFields":"*",&lt;BR /&gt;      "outStatistics":"[{\"onStatisticField\":\"id\",\"outStatisticFieldName\":\"value\",\"statisticType\":\"count\"}]",&lt;BR /&gt;      "resultType":"standard",&lt;BR /&gt;      "returnGeometry":"false",&lt;BR /&gt;      "spatialRel":"esriSpatialRelIntersects",&lt;BR /&gt;      "where":"(&lt;STRONG&gt;sale_date&amp;gt;timestamp '2006-01-02 05:59:59' AND valid_sale=0) AND (sale_date BETWEEN timestamp '2020-01-01 06:00:00' AND timestamp '2021-01-01 05:59:59')&lt;/STRONG&gt;"&lt;BR /&gt;    }}}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only way to get a date filter to work would be to create a true date field. You wouldn't be the first person to create a new field for the sake of a dashboard!&lt;/P&gt;&lt;P&gt;Does the text field consistently contain date values? And is there a reason to maintain it as a text field instead of just converting it?&lt;/P&gt;</description>
    <pubDate>Mon, 19 Apr 2021 22:04:03 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2021-04-19T22:04:03Z</dc:date>
    <item>
      <title>Can you cast data from string field type to date for use in dashboard date selector</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/can-you-cast-data-from-string-field-type-to-date/m-p/1048849#M39565</link>
      <description>&lt;P&gt;Can you use Arcade to change a field type from Text to Date on the fly for use with a dashboard date selector? I see how it can be done in a pop up, but that doesn't interact with the date selector.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It looks like a data expression would work. Are there any examples similar to my use case?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 19:50:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/can-you-cast-data-from-string-field-type-to-date/m-p/1048849#M39565</guid>
      <dc:creator>LeeIrminger</dc:creator>
      <dc:date>2021-04-19T19:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: Can you cast data from string field type to date for use in dashboard date selector</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/can-you-cast-data-from-string-field-type-to-date/m-p/1048874#M39566</link>
      <description>&lt;P&gt;yeh I'd definitely say a data expression.&amp;nbsp; Syntax would be exactly the same as the popup, except that you would reference the feature first by something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;(abridged example from&amp;nbsp;&lt;A href="https://developers.arcgis.com/arcade/function-reference/data_functions/#featuresetbyportalitem" target="_blank"&gt;Data Functions | ArcGIS for Developers&lt;/A&gt;)&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var portal = Portal('https://www.arcgis.com');
var features = FeatureSetByPortalItem(portal, '7b1fb95ab77f40bf8aa09c8b59045449')&lt;/LI-CODE&gt;&lt;P&gt;I can't really offer you an example of the date string to datetime/Esri date without knowing what the string looks like, but here are some example methods &lt;A href="https://developers.arcgis.com/arcade/function-reference/date_functions/" target="_blank"&gt;Date Functions | ArcGIS for Developers&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 20:00:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/can-you-cast-data-from-string-field-type-to-date/m-p/1048874#M39566</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-04-19T20:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Can you cast data from string field type to date for use in dashboard date selector</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/can-you-cast-data-from-string-field-type-to-date/m-p/1048906#M39570</link>
      <description>&lt;P&gt;Unfortunately, you can't get Arcade to work like that in the dashboard. A date selector is "layer agnostic", so to speak, and can't work with non-attribute data, as it is essentially just submitting an SQL query to the feature service.&lt;/P&gt;&lt;P&gt;If you watch the network traffic on your browser, you can see it happen:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1618869419607.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/11283iFF93E01DAAB70520/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1618869419607.png" alt="jcarlson_0-1618869419607.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Picking that option sends this to request (relevant part bolded):&lt;/P&gt;&lt;PRE&gt;{"GET":&lt;BR /&gt;  {&lt;BR /&gt;    "scheme":"https",&lt;BR /&gt;    "host":"services6.arcgis.com",&lt;BR /&gt;    "filename":"/U1zX3Wx8hhY7Gb30/arcgis/rest/services/Sales_Hosted/FeatureServer/0/query",&lt;BR /&gt;    "query":{&lt;BR /&gt;      "f":"json",&lt;BR /&gt;      "cacheHint":"true",&lt;BR /&gt;      "groupByFieldsForStatistics":"sale_year,valid_sale",&lt;BR /&gt;      "orderByFields":"sale_year ASC",&lt;BR /&gt;      "outFields":"*",&lt;BR /&gt;      "outStatistics":"[{\"onStatisticField\":\"id\",\"outStatisticFieldName\":\"value\",\"statisticType\":\"count\"}]",&lt;BR /&gt;      "resultType":"standard",&lt;BR /&gt;      "returnGeometry":"false",&lt;BR /&gt;      "spatialRel":"esriSpatialRelIntersects",&lt;BR /&gt;      "where":"(&lt;STRONG&gt;sale_date&amp;gt;timestamp '2006-01-02 05:59:59' AND valid_sale=0) AND (sale_date BETWEEN timestamp '2020-01-01 06:00:00' AND timestamp '2021-01-01 05:59:59')&lt;/STRONG&gt;"&lt;BR /&gt;    }}}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only way to get a date filter to work would be to create a true date field. You wouldn't be the first person to create a new field for the sake of a dashboard!&lt;/P&gt;&lt;P&gt;Does the text field consistently contain date values? And is there a reason to maintain it as a text field instead of just converting it?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 22:04:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/can-you-cast-data-from-string-field-type-to-date/m-p/1048906#M39570</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-04-19T22:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: Can you cast data from string field type to date for use in dashboard date selector</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/can-you-cast-data-from-string-field-type-to-date/m-p/1051083#M39684</link>
      <description>&lt;P&gt;On looking at the question again, it's not going to be easy, but theoretically you could iterate through the original values and create a text representation of the JSON to create a new feature set with all the existing and new date values - but it's far from trivial.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Apr 2021 19:10:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/can-you-cast-data-from-string-field-type-to-date/m-p/1051083#M39684</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-04-24T19:10:34Z</dc:date>
    </item>
  </channel>
</rss>

