Hi,
I'm trying to create an indicator in ArcGIS Dashboards that display the percentage of features with a specific attribute value using an Arcade expression. I can see the correct result in the create new expression window, but once i click "done", the indicator displays: "Unable to execute arcade script"
For context:
- I have a hosted feature layer with a field called "estado".
- I want to calculate the percentage of those features where estado = 'Rechazada IPEEM/Archivo'.
- Running the script in the create new expression window returns the FeatureSet correctly.
- Log window doesn't display any warnings or errors.
var capa = FeatureSetByPortalItem(
Portal(''),
'597723f82afb4031a8211a2a993c7688', // Feature layer ID
0,
['estado']
);
var total = Count(capa);
var rechazadas = Count(Filter(capa, "estado = 'Rechazada IPEEM/Archivo'"));
var porcentaje = IIf(total == 0, 0, Round((rechazadas / total) * 100, 1));
return {
fields: [
{ name: "porcentaje", type: "esriFieldTypeDouble" }
],
geometryType: "",
features: [
{
attributes: {
porcentaje: porcentaje
}
}
]
};