<?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: Dashboard data Expression returns null featureset in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-data-expression-returns-null-featureset/m-p/1623216#M11195</link>
    <description>&lt;P&gt;There were a couple of things that needed changing.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The dates are incorrect if you're portraying 1 July through 30 Sept. In the Date function, months are 0-based, so July is 6, not 7 (lines 5, 6, and 7)&lt;/LI&gt;&lt;LI&gt;The SeasonPerc was a NaN since you were converting the Dates to numbers (lines 5, 6, and 7). The DateDiff function needs Dates as input, not the converted number.&lt;/LI&gt;&lt;LI&gt;DateDiff also returns a number, so there's no need to convert it (lines 9 and 10)&lt;/LI&gt;&lt;LI&gt;SeasonPerc has to be&amp;nbsp;an integer if you're putting it into a integer field (line 11). If it's not converted (and Arcade will not convert it for you), that field attribute will be null.&lt;/LI&gt;&lt;LI&gt;You have to push a dictionary object containing the "attributes" key into the features array (line 15)&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="javascript"&gt;var ThisYear = Year(Now());
//var ThisMonth = Month(Now());
//var ThisDay = Day(Now())

var startDate = Date(ThisYear, 6, 1);
var endDate = Date(ThisYear, 8, 30);
var currentDate = Date(ThisYear, 6, 25);

var Season = DateDiff(endDate, startDate);
var SeasonSoFar = DateDiff(currentDate, startDate);
var SeasonPerc = Round(Number(SeasonSoFar / Season * 100));

var features = [];

Push(features, { attributes: { DayPercentage: SeasonPerc } });

var PercDict = {
  fields: [{ name: "DayPercentage", type: "esriFieldTypeInteger" }],
  features: features
};

var features2 = FeatureSet(PercDict);

return features2;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Jun 2025 19:58:59 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2025-06-12T19:58:59Z</dc:date>
    <item>
      <title>Dashboard data Expression returns null featureset</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-data-expression-returns-null-featureset/m-p/1623203#M11193</link>
      <description>&lt;P&gt;I am trying to create a dashboard gauge to show percentage of time passed in a season. So, if the season runs from 1 July to 30 September, then on 23 July, the gauge should read 25%.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the FeatureSet to show the percentage in the 'DayPercentage' field for the gauge.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Arcade code to do so is as follows:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var ThisYear = Number(Year(Now()));
//var ThisMonth = Month(Now());
//var ThisDay = Day(Now())

var startDate = Number(Date(ThisYear,7,1));
var endDate = Number(Date(ThisYear,9,30));
var currentDate = Number(Date(ThisYear, 7, 25));

var Season = Number(DateDiff(endDate,startDate))
var SeasonSoFar = Number(DateDiff(currentDate,startDate))
var SeasonPerc = Number((SeasonSoFar/Season)*100);

var features = [];

Push(features, SeasonPerc)

var PercDict = {
  'fields': [
    {'name':'DayPercentage','type':'esriFieldTypeInteger'}
  ],
  'features': features
};

var features2 = FeatureSet(PercDict);

return features2&lt;/LI-CODE&gt;&lt;P&gt;This returns a null dataset. I've tried formatting the Dictionary differently, formatting the FeatureSet differently, using Push to get the data through in different places and formats, and I'm stuck. What am I doing wrong?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 19:25:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-data-expression-returns-null-featureset/m-p/1623203#M11193</guid>
      <dc:creator>SamBelisleLID1990</dc:creator>
      <dc:date>2025-06-12T19:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard data Expression returns null featureset</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-data-expression-returns-null-featureset/m-p/1623216#M11195</link>
      <description>&lt;P&gt;There were a couple of things that needed changing.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The dates are incorrect if you're portraying 1 July through 30 Sept. In the Date function, months are 0-based, so July is 6, not 7 (lines 5, 6, and 7)&lt;/LI&gt;&lt;LI&gt;The SeasonPerc was a NaN since you were converting the Dates to numbers (lines 5, 6, and 7). The DateDiff function needs Dates as input, not the converted number.&lt;/LI&gt;&lt;LI&gt;DateDiff also returns a number, so there's no need to convert it (lines 9 and 10)&lt;/LI&gt;&lt;LI&gt;SeasonPerc has to be&amp;nbsp;an integer if you're putting it into a integer field (line 11). If it's not converted (and Arcade will not convert it for you), that field attribute will be null.&lt;/LI&gt;&lt;LI&gt;You have to push a dictionary object containing the "attributes" key into the features array (line 15)&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="javascript"&gt;var ThisYear = Year(Now());
//var ThisMonth = Month(Now());
//var ThisDay = Day(Now())

var startDate = Date(ThisYear, 6, 1);
var endDate = Date(ThisYear, 8, 30);
var currentDate = Date(ThisYear, 6, 25);

var Season = DateDiff(endDate, startDate);
var SeasonSoFar = DateDiff(currentDate, startDate);
var SeasonPerc = Round(Number(SeasonSoFar / Season * 100));

var features = [];

Push(features, { attributes: { DayPercentage: SeasonPerc } });

var PercDict = {
  fields: [{ name: "DayPercentage", type: "esriFieldTypeInteger" }],
  features: features
};

var features2 = FeatureSet(PercDict);

return features2;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 19:58:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-data-expression-returns-null-featureset/m-p/1623216#M11195</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2025-06-12T19:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard data Expression returns null featureset</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-data-expression-returns-null-featureset/m-p/1623242#M11196</link>
      <description>&lt;P&gt;Thank you so much!&lt;/P&gt;&lt;P&gt;Many of those changes were things I had actually done correctly the first time but had changed in all my attempts to fix this. The push with attributes was the missing piece.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 20:33:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-data-expression-returns-null-featureset/m-p/1623242#M11196</guid>
      <dc:creator>SamBelisleLID1990</dc:creator>
      <dc:date>2025-06-12T20:33:41Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard data Expression returns null featureset</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-data-expression-returns-null-featureset/m-p/1623383#M11198</link>
      <description>&lt;P&gt;Glad to help. Please check the "Accept as Solution" box to help others searching on this problem&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jun 2025 11:19:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/dashboard-data-expression-returns-null-featureset/m-p/1623383#M11198</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2025-06-13T11:19:11Z</dc:date>
    </item>
  </channel>
</rss>

