<?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 Date field returns empty in Arcade expression in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/date-field-returns-empty-in-arcade-expression/m-p/1284421#M7729</link>
    <description>&lt;P&gt;I have a data expression for a dashboard indicator (below). The problem is that the 'created_date' field returns no values. I have seen the &lt;A href="https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expressions-with-date-column-not/m-p/1260473#M7365" target="_blank" rel="noopener"&gt;thread here&lt;/A&gt;, but can't see where I'm going wrong. The date does show up in the Console as either:&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Script: &lt;/STRONG&gt;attributes: {sample: po['sample_id_post_pfas'],created: Number(po['created_date'])}:&lt;/FONT&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Console:&lt;/FONT&gt;&lt;/STRONG&gt; {"attributes":{"sample":"123-A-456","created":1678124975146}}&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Script: &lt;/STRONG&gt;attributes: {sample: po['sample_id_post_pfas'],created: po['created_date']}:&lt;/FONT&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Console: &lt;/FONT&gt;&lt;/STRONG&gt;{"attributes":{"sample":"123-A-456","created":"2023-03-06T17:49:35.146Z"}}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;The basic idea is that there are 700+ records, each of which can have null or values in any of 7 id fields, although only checking 3 here. My goal is to get a count of all non-null ids, along with the date created (same date for all ids in a single record). If I have 700 records, for example, there might be 900 samples. I've got the count, but want to be able to filter by date in the dashboard.&lt;/P&gt;&lt;P&gt;Any idea what I'm missing? Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var p = Portal('gisportal')
var fs = FeatureSetByPortalItem(
    p,
    '6a8fd262c6e641c6bc9513da29fc3910',
    0,
    [
        'sample_id_dup',
        'sample_id_pre',
        'sample_id_post',
        'created_date'
     ],
    false
    );    
var dup = Filter(fs, 'sample_id_dup IS NOT NULL');    
var pre = Filter(fs, 'sample_id_pre IS NOT NULL');
var post = Filter(fs, 'sample_id_post IS NOT NULL');
var features = [];
var feat;
for (var d in dup) {
    feat = {
        attributes: {
            sample: d['sample_id_dup'],
            created: Number(d['created_date'])
        },
    };
    Push(features, feat);
};

for (var pr in pre) {
    feat = {
        attributes: {
            sample: pr['sample_id_pre'],
            created: Number(pr['created_date'])
        },
    };
    Push(features, feat);
};

for (var po in post) {
    feat = {
        attributes: {
            sample: po['sample_id_post'],
            created: Number(po['created_date'])
        },
    };
    Push(features, feat);
};

var joinedDict = {
    fields: [
            {name: 'sample', type: 'esriFieldTypeString'},
            {name: 'created_date', type: 'esriFieldTypeDate'}
    ],
    geometryType: '',
    features: features
}

return FeatureSet(Text(joinedDict));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 01 May 2023 16:45:29 GMT</pubDate>
    <dc:creator>ZenMasterZeke</dc:creator>
    <dc:date>2023-05-01T16:45:29Z</dc:date>
    <item>
      <title>Date field returns empty in Arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/date-field-returns-empty-in-arcade-expression/m-p/1284421#M7729</link>
      <description>&lt;P&gt;I have a data expression for a dashboard indicator (below). The problem is that the 'created_date' field returns no values. I have seen the &lt;A href="https://community.esri.com/t5/arcgis-dashboards-questions/arcade-data-expressions-with-date-column-not/m-p/1260473#M7365" target="_blank" rel="noopener"&gt;thread here&lt;/A&gt;, but can't see where I'm going wrong. The date does show up in the Console as either:&lt;/P&gt;&lt;PRE&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Script: &lt;/STRONG&gt;attributes: {sample: po['sample_id_post_pfas'],created: Number(po['created_date'])}:&lt;/FONT&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Console:&lt;/FONT&gt;&lt;/STRONG&gt; {"attributes":{"sample":"123-A-456","created":1678124975146}}&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Script: &lt;/STRONG&gt;attributes: {sample: po['sample_id_post_pfas'],created: po['created_date']}:&lt;/FONT&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Console: &lt;/FONT&gt;&lt;/STRONG&gt;{"attributes":{"sample":"123-A-456","created":"2023-03-06T17:49:35.146Z"}}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;The basic idea is that there are 700+ records, each of which can have null or values in any of 7 id fields, although only checking 3 here. My goal is to get a count of all non-null ids, along with the date created (same date for all ids in a single record). If I have 700 records, for example, there might be 900 samples. I've got the count, but want to be able to filter by date in the dashboard.&lt;/P&gt;&lt;P&gt;Any idea what I'm missing? Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var p = Portal('gisportal')
var fs = FeatureSetByPortalItem(
    p,
    '6a8fd262c6e641c6bc9513da29fc3910',
    0,
    [
        'sample_id_dup',
        'sample_id_pre',
        'sample_id_post',
        'created_date'
     ],
    false
    );    
var dup = Filter(fs, 'sample_id_dup IS NOT NULL');    
var pre = Filter(fs, 'sample_id_pre IS NOT NULL');
var post = Filter(fs, 'sample_id_post IS NOT NULL');
var features = [];
var feat;
for (var d in dup) {
    feat = {
        attributes: {
            sample: d['sample_id_dup'],
            created: Number(d['created_date'])
        },
    };
    Push(features, feat);
};

for (var pr in pre) {
    feat = {
        attributes: {
            sample: pr['sample_id_pre'],
            created: Number(pr['created_date'])
        },
    };
    Push(features, feat);
};

for (var po in post) {
    feat = {
        attributes: {
            sample: po['sample_id_post'],
            created: Number(po['created_date'])
        },
    };
    Push(features, feat);
};

var joinedDict = {
    fields: [
            {name: 'sample', type: 'esriFieldTypeString'},
            {name: 'created_date', type: 'esriFieldTypeDate'}
    ],
    geometryType: '',
    features: features
}

return FeatureSet(Text(joinedDict));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2023 16:45:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/date-field-returns-empty-in-arcade-expression/m-p/1284421#M7729</guid>
      <dc:creator>ZenMasterZeke</dc:creator>
      <dc:date>2023-05-01T16:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: Date field returns empty in Arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/date-field-returns-empty-in-arcade-expression/m-p/1284496#M7734</link>
      <description>&lt;P&gt;You named the field "created_date" (line 52), but in the features, you call it "created" (lines 23. 33, 34). They have to be the same.&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2023 20:16:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/date-field-returns-empty-in-arcade-expression/m-p/1284496#M7734</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-05-01T20:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: Date field returns empty in Arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/date-field-returns-empty-in-arcade-expression/m-p/1284522#M7737</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;. Obvious in hindsight&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":upside_down_face:"&gt;🙃&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2023 20:58:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/date-field-returns-empty-in-arcade-expression/m-p/1284522#M7737</guid>
      <dc:creator>ZenMasterZeke</dc:creator>
      <dc:date>2023-05-01T20:58:44Z</dc:date>
    </item>
  </channel>
</rss>

