My objective is to create a serial chart that SUMs a field called "Miles" by the week it was edited using the "Editor" field, and it does this for all layers in the chart.
These are featuresets from different projects, but the schema is the same. I know haven't addressed the week bracketing at all yet, I'm just trying to get the data coming into the chart.
The only error I'm getting currently is "Invalid variable assignment". It's flagging the first GroupBy(, there are no other known errors.
I've been referencing the linked posts. Any help would be most appreciated.
CombineMultipleLayers(SerialChart) Calculate a statistic on a virtual field
var agol = Portal('https://*********.maps.arcgis.com/');
var fs1 = GroupBy(
FeatureSetByPortalItem(agol,'****************************',15,['*']false,
['Miles'],
[
{ name:'total_miles1', expression:'Miles', statistic:'SUM'}
]
);
var fs2 = GroupBy(
FeatureSetByPortalItem(agol,'****************************',15,['*']false,
['Miles'],
[
{ name:'total_miles2', expression:'Miles', statistic:'SUM'}
]
);
var features = [];
var feat;
for (var w in fs1) {
feat = {
attributes: {
count_the_miles: SUM(w['total_miles1']),
},
};
Push(features, feat);
}
for (var p in fs2) {
feat = {
attributes: {
count_the_miles: SUM(p['total_miles2']),
},
};
Push(features, feat);
}
var combinedDict = {
fields: [
{ name: 'count_the_miles', type: 'esriFieldTypeInteger'},
],
geometryType: '',
features: features,
};
return FeatureSet(combinedDict);