<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Popup calculations with Arcade - with null values in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/popup-calculations-with-arcade-with-null-values/m-p/1623068#M65057</link>
    <description>&lt;P&gt;Create a key that uses a substitute string if i.NAME is blank (line 9) and use that key for the dictionary (lines 10, 11, and 13). Note that I moved the calculation of out_str outside the for loop. It doesn't need to be calculated for each item in the intersected FeatureSet.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;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");
  var key = iif(IsEmpty(i.NAME), "Empty", i.NAME);
  if (HasKey(int_dict, key)) {
    int_dict[key] += xs;
  } else {
    int_dict[key] = 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;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Jun 2025 15:10:30 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2025-06-12T15:10:30Z</dc:date>
    <item>
      <title>Popup calculations with Arcade - with null values</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/popup-calculations-with-arcade-with-null-values/m-p/1622880#M65055</link>
      <description>&lt;P&gt;Hi, I'm trying to calculate the areas and lengths of intersecting layers within a selected polygon. I found a really helpful script here:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-online-questions/popup-calculations-with-arcade/td-p/1031224" target="_blank" rel="noopener"&gt;Solved: Popup calculations with Arcade - Esri Community&lt;/A&gt;. 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?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;PRE&gt;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&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jun 2025 21:12:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/popup-calculations-with-arcade-with-null-values/m-p/1622880#M65055</guid>
      <dc:creator>Jennifer_T</dc:creator>
      <dc:date>2025-06-11T21:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: Popup calculations with Arcade - with null values</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/popup-calculations-with-arcade-with-null-values/m-p/1623068#M65057</link>
      <description>&lt;P&gt;Create a key that uses a substitute string if i.NAME is blank (line 9) and use that key for the dictionary (lines 10, 11, and 13). Note that I moved the calculation of out_str outside the for loop. It doesn't need to be calculated for each item in the intersected FeatureSet.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;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");
  var key = iif(IsEmpty(i.NAME), "Empty", i.NAME);
  if (HasKey(int_dict, key)) {
    int_dict[key] += xs;
  } else {
    int_dict[key] = 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;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 15:10:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/popup-calculations-with-arcade-with-null-values/m-p/1623068#M65057</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2025-06-12T15:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: Popup calculations with Arcade - with null values</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/popup-calculations-with-arcade-with-null-values/m-p/1623077#M65058</link>
      <description>&lt;P&gt;Amazing! this did the trick&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2025 15:19:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/popup-calculations-with-arcade-with-null-values/m-p/1623077#M65058</guid>
      <dc:creator>Jennifer_T</dc:creator>
      <dc:date>2025-06-12T15:19:13Z</dc:date>
    </item>
  </channel>
</rss>

