Aloha,
I think this topic has lightly been discussed before, however I have been running into issues with trying to create an expression that will pull data from two different features and output the sum of that data. Based on the code example below (paths and IDs have been removed for privacy), the error I receive is "Execution Error: Unsupported RHS for IS".
Also attached was the original reference post I used to initially create the expression.
Any help would be greatly appreciated.
Mahalo,
Derek Salinas
var sql = 'status IS R OR status IS A OR status IS C'
var portal = Portal('Enterprise Portal Directory Here')
//Create a feature set for each point, line, and polygon layer and include the cost feild
var point_fs = FeatureSetByPortalItem(portal, 'ITEM ID HERE', 17, ['status'], false)
var sum_point = Sum(Filter(point_fs, sql), 'status')
var line_fs = FeatureSetByPortalItem(portal, 'ITEM ID HERE', 15, ['status'], false)
var sum_point = Sum(Filter(line_fs, sql), 'status')
//Create an empty array and variable for the new FeatureSet that you will push/combine your features into
var features = [];
var feat;
//Push each feature from each layer into the empty array
for (var f in point_fs) {
feat = {
'attributes': {
'status': f['status']
}
};
Push(features, feat)
}
for (var f in line_fs) {
feat = {
'attributes': {
'status': f['status']
}
};
Push(features, feat)
}
//Create final FeatureSet from combined features
var combinedDict = {
'fields': [
{ 'name': 'status', 'type': 'esriFieldTypestring' },
],
'geometryType': '',
'features': features,
};
return FeatureSet(Text(combinedDict));