I am trying to create an indicator that will display a number for both the number of critical infrastructures within an impacted area as well as the number of hospitals within an active evacuation zone. I am receiving an error message saying "Test execution error: Unknown Error. Verify test data." I am having a hard time deciphering what the issue with the code is.
Here is the code for reference:
//Layer source information
var p = portal('https://arcgis.com');
var crit_infra = FeatureSetByPortalItem(portal(p), 'fbb2f2bd73cb4ece92800d3527f9680d', 0, ['*']);
var impacted_area = FILTER(FeatureSetByPortalItem(portal(p), '996efbd08dc8478d9a9315a33ed50bda', 0, ['*']), "activeincid = 'Yes'");
var hcc_mem = FeatureSetByPortalItem(portal(p), '45e9dac6ea264c76818149c4b15717ea', 0, ['*']);
var evac_zone = FILTER(FeatureSetByPortalItem(portal(p), 'b84c5fc156f3420398e21b93c75c00b9', 0, ['*']), "activeincid = 'Yes'");
var final_count = 0;
//Get total count of critical infrastructure intersected by any active impacted areas
for(var i in impacted_area){
var i_count = Count(Intersects(crit_infra, i))
Console(i_count + ' critical infrastructure')
final_count += i_count
Console(final_count)
};
var hcc_count = 0;
//Get total count of hcc members intersected by any active evacuation zones
for (var j in evac_zone){
var j_count = Count(Intersects(hcc_mem, j))
Console(j_count + 'hcc members')
hcc_count += j_count
Console(hcc_count)
};
//Create data schema
var tabl = {
'fields': [
{'name': 'cntType',
'type': 'esriFieldTypeString'},
{'name': 'cntImpCI',
'type': 'esriFieldTypeInteger'},
{'name': 'cntTypes',
'type': 'esriFieldTypeString'},
{'name': 'cntHCC',
'type': 'esriFieldTypeInteger'}],
'geometryType': '',
'features': [],
};
//add data to data schema
tabl.features[0] = {
'attributes':{
'cntType': 'Impacted Infrastructure',
'cntImpCI': final_count,
'cntTypes': 'HCC Members',
'cntHCC': hcc_count,
}
};
//return the featureset
return FeatureSet(Text(tabl));