<?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: Data Expression Returning Empty in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-returning-empty/m-p/1321439#M8353</link>
    <description>&lt;P&gt;Replace line 25 with this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;'incident_date': Number(f.incident_date),&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In previous Arcade versions, Date values had to be submitted as Numbers. &lt;A href="https://community.esri.com/t5/arcgis-online-ideas/arcade-allow-date-values-in-date-fields/idc-p/1299909/highlight/true#M10198" target="_blank" rel="noopener"&gt;This problem is fixed in AGOL and will probably be fixed in Enterprise 11.2&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Aug 2023 22:28:58 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2023-08-22T22:28:58Z</dc:date>
    <item>
      <title>Data Expression Returning Empty</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-returning-empty/m-p/1321410#M8350</link>
      <description>&lt;P&gt;I have tried this 8 ways to Sunday and I can't get it to work.&amp;nbsp; This is the furthest I have gotten, and I am hoping someone can help me get the rest of the way.&amp;nbsp; We are operating version 10.9.1 on our portal server.&lt;/P&gt;&lt;P&gt;I am trying to create a data expression for a dashboard that is fed by Survey 123.&amp;nbsp; I am accessing the "Results" layer, and I own it.&amp;nbsp; Editing is enabled, but Sync is disabled.&amp;nbsp; All I really want to do is add 5 fields to the original and calculate them based on the incident date, I need to have the ability to aggregate on Year, Month, Day of Week, Hour and Quarter.&amp;nbsp; The calculations appear to be working, but the output comes out with a list of empty fields.&lt;/P&gt;&lt;P&gt;here is my code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;var portal =Portal('https://egis-sige.rcmp-grc.gc.ca/portal');
var fs = FeatureSetByPortalItem(portal, '6324abd8c2744757871fe4ee85272666',1,['incident_date', 'duration', 'district', 'detachment','tasks', 'foi', 'incident_summary','incident_no'],false);

var s = Schema(fs)
var sFldCount = Count(s.fields)
var newFldCount = sFldCount

s.fields[newFldCount] = {alias: 'Year', defaultValue: null, editable: true, length: 5, name: 'occ_year', type: 'esriFieldTypeString'}
s.fields[newFldCount+1] = {alias: 'Month', defaultValue: null, editable: true, length: 25, name: 'occ_month', type: 'esriFieldTypeString'}
s.fields[newFldCount+2] = {alias: 'Day of Week', defaultValue: null, editable: true, length: 25, name: 'dow', type: 'esriFieldTypeString'}
s.fields[newFldCount+3] = {alias: 'Hour', defaultValue: null, editable: true, length: 5, name: 'occ_hour', type: 'esriFieldTypeString'}
s.fields[newFldCount+4] = {alias: 'Quarter', defaultValue: null, editable: true, length: 5, name: 'quarter', type: 'esriFieldTypeString'}

var returnFS = {
fields: s.fields,
geometryType: '',
features:[],
}
console(returnFS)
var index = 0;

for (var f in fs) {
returnFS.features[index] = {
'fields': {
'incident_date': f.incident_date,
'duration': f.duration,
'district': f.district,
'detachment': f.detachment,
'tasks': f.tasks,
'foi': f.foi,
'incident_summary': f.incident_summary,
'incident_no': f.incident_no,
'occ_year': Text(f.incident_date,"yyyy"),
'occ_month': Text(f.incident_date, "MMMM"),
'dow': Text(f.incident_date, "dddd"),
'occ_hour': Text(f.incident_date, "HH"),
'quarter': IIF(ISOMonth(f.incident_date)&amp;gt;9, "Q3", IIF(ISOMonth(f.incident_date)&amp;gt;6,"Q2",IIF(ISOMonth(f.incident_date)&amp;gt;3,"Q1","Q4")))
}

}
index++; };
console(returnFS)
return FeatureSet(Text(returnFS))&lt;/LI-CODE&gt;&lt;P&gt;I have tried the above, I have tried populating a "features" array and feeding that to the dictionary, and I have tried the Push() function in a For Loop to push a feature into the Features element of the dictionary.&amp;nbsp; this is the only version that pretends to work, the features are going in/coming out, but not with all their attributes:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EBurridge_0-1692739891958.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/78861i898C81037192B496/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EBurridge_0-1692739891958.png" alt="EBurridge_0-1692739891958.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you!!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 21:34:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-returning-empty/m-p/1321410#M8350</guid>
      <dc:creator>EBurridge</dc:creator>
      <dc:date>2023-08-22T21:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: Data Expression Returning Empty</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-returning-empty/m-p/1321439#M8353</link>
      <description>&lt;P&gt;Replace line 25 with this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;'incident_date': Number(f.incident_date),&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In previous Arcade versions, Date values had to be submitted as Numbers. &lt;A href="https://community.esri.com/t5/arcgis-online-ideas/arcade-allow-date-values-in-date-fields/idc-p/1299909/highlight/true#M10198" target="_blank" rel="noopener"&gt;This problem is fixed in AGOL and will probably be fixed in Enterprise 11.2&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 22:28:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-returning-empty/m-p/1321439#M8353</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-08-22T22:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: Data Expression Returning Empty</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-returning-empty/m-p/1321915#M8362</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;@JohannesLinder!&amp;nbsp;I changed just that row, and nothing changed about my output - it is all the same, about 2000 features with not a single populated attribute.&lt;/P&gt;&lt;P&gt;I then changed the field definitions in the dictionary to make the incident_date a numeric field, but that also didn't work.&lt;/P&gt;&lt;P&gt;Any other suggestions?&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2023 21:06:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-returning-empty/m-p/1321915#M8362</guid>
      <dc:creator>EBurridge</dc:creator>
      <dc:date>2023-08-23T21:06:31Z</dc:date>
    </item>
  </channel>
</rss>

