Hi, I'm trying to calculate the areas and lengths of intersecting layers within a selected polygon. I found a really helpful script here: Solved: Popup calculations with Arcade - Esri Community. It has gotten me to 90% to where I need to be. The problem is that this arcade script doesn't like blank or null values. I believe HasKey is the culprit. I need these "blank" values calculated in the popup (and renamed if possible). Is there a solution or workaround? maybe incorporating DefautValue or IsEmpty somehow?
Thank you
var managementareas = FeatureSetByName($map,"ManagmentAreas");
var int_ma = Intersects($feature, managementareas)
var int_dict = {}
var xs = 0
for (var i in int_ma){
var xs = AreaGeodetic(Intersection($feature, i), 'acres')
if(HasKey(int_dict,i.Name)){
int_dict[i.NAME] += xs
} else {
int_dict[i.NAME] = xs
}
var out_str = 'Management Area Acreage: ';
for (var d in int_dict){
out_str += '\n' + d + '\t|\t' + Text(int_dict[d], '#,###.#')
}}
return out_str