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%.
I want the FeatureSet to show the percentage in the 'DayPercentage' field for the gauge.
My Arcade code to do so is as follows:
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 features2This 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?