I have used the data expression below for an Indicator in my dashboard to sum fields across layers. the Indicator works fine, but as soon as I enable Map Actions for that Indicator, the Indicator stops working.
Any ideas on how to resolve the issue?
var portal = Portal('https://www.arcgis.com/');
// p1
var p1 = FeatureSetByPortalItem(portal,'4b8fd0f3453a447684f3f3db69bdc935',0,['OBJECTID'],true);
var p1_Count = COUNT(p1);
// p2
var p2 = FeatureSetByPortalItem(portal,'4b8fd0f3453a447684f3f3db69bdc935',1,['OBJECTID'],true);
var p2_Count = COUNT(p2);
// p3
var p3 = FeatureSetByPortalItem(portal,'4b8fd0f3453a447684f3f3db69bdc935',2,['OBJECTID'],true);
var p3_Count = COUNT(p3);
// Total number
var total = p1_Count + p2_Count + p3_Count
// create data schema
var dict = {
'fields': [
{'name': 'number', 'type': 'esriFieldTypeInteger'}],
'geometryType': 'esriGeometryPoint',
'features': []};
// fill the data schema with the data
dict.features[0] = {
'attributes': {
'number': total
},
geometry: Geometry(dict)
};
// return the featureset
return FeatureSet(Text(dict));
Solved! Go to Solution.
It seems that a BUG has been identified for the issue.
BUG-000151997 Arcade functions are unable to sum and combine features while maintaining the geometry so that map actions can be applied in ArcGIS Dashboards. https://support.esri.com/en/bugs/nimbus/QlVHLTAwMDE1MTk5Nw==
To insert code:
It might be because you're inserting an invalid geometry into the FeatureSet. You're calling Geometry() on a Dictionary, which results in a null value. So you return a point FeatureSet with one row that has an invalid geometry.
A FeatureSet isn't required to have a geometry column, it can also be a simple table. Try this:
// create data schema
var dict = {
'fields': [
{'name': 'number', 'type': 'esriFieldTypeInteger'}],
'geometryType': '', // no geometry
'features': []
};
// fill the data schema with the data
dict.features[0] = {
'attributes': {'number': total}
};
// return the featureset
return FeatureSet(Text(dict));
Hi @JohannesLindner,
Thank you for your reply.
I tried with no geometry and still the same result.
var portal = Portal('https://www.arcgis.com/');
// p1
var p1 = FeatureSetByPortalItem(portal,'4b8fd0f3453a447684f3f3db69bdc935',0,['OBJECTID'],true);
var p1_Count = COUNT(p1);
// p2
var p2 = FeatureSetByPortalItem(portal,'4b8fd0f3453a447684f3f3db69bdc935',1,['OBJECTID'],true);
var p2_Count = COUNT(p2);
// p3
var p3 = FeatureSetByPortalItem(portal,'4b8fd0f3453a447684f3f3db69bdc935',2,['OBJECTID'],true);
var p3_Count = COUNT(p3);
// Total number
var total = p1_Count + p2_Count + p3_Count
// create data schema
var dict = {
'fields': [
{'name': 'number', 'type': 'esriFieldTypeInteger'}],
'geometryType': '',
'features': []};
// fill the data schema with the data
dict.features[0] = {
'attributes': {'number': total},
};
// return the featureset
return FeatureSet(Text(dict));
Regards,
Ehsan
It seems that a BUG has been identified for the issue.
BUG-000151997 Arcade functions are unable to sum and combine features while maintaining the geometry so that map actions can be applied in ArcGIS Dashboards. https://support.esri.com/en/bugs/nimbus/QlVHLTAwMDE1MTk5Nw==