I'm working on creating a pie chart to display the total time by patrol type. I have a startTime field and an endTime field in my feature service. I'm displaying it by PatrolType. I have gotten close but I think I'm getting messed up by the field types for time/minutes, etc. Or maybe somethign else is wrong. I get no results but no errors. I'm on a steep learning curve so examples have gotten me most of the way.
Would you use the DateDiff to get the time or is there another way? I was attempting to see how many minutes each patrol was, and then display the total minutes for each patrol type. And do I then need to then Sum up the elapsed minutes?
var myPortal = 'https://boulder.maps.arcgis.com/';
var patrol = FeatureSetByPortalItem(Portal(myPortal), '2a61f35432e24069bdd1a9102d02f0ba', 0, ["startTime", "endTime", "PatrolType", "created_date"], false)
var Dict = {
'fields' : [
{'name' : 'Patrol Type', 'type': 'esriFieldTypeString'},
{'name' : 'Time Elapse', 'type': 'esriFieldTypeDate'},
],
geometryType: "",
features: [],
};
[{'attributes': {
'Patrol Type' : 'PatrolType',
'Time Elapse': DateDiff("endTime", "startTime", 'minutes')
}}
];
return FeatureSet(Text(Dict));