Indicator shows "No data" as soon as Map Actions is enabled.

126
3
Jump to solution
08-10-2022 10:03 PM
EhsanKafai
Esri Contributor

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));

 

EhsanKafai_0-1660193293698.png

 

0 Kudos
1 Solution

Accepted Solutions
EhsanKafai
Esri Contributor

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==

View solution in original post

0 Kudos
3 Replies
JohannesLindner
MVP Regular Contributor

To insert code:

JohannesLindner_0-1660201651952.png

JohannesLindner_1-1660201678170.png

 

 

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));

Have a great day!
Johannes
0 Kudos
EhsanKafai
Esri Contributor

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

0 Kudos
EhsanKafai
Esri Contributor

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==

0 Kudos