<?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: Field Calculate taking hours to run on less than 20000 feature? in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/field-calculate-taking-hours-to-run-on-less-than/m-p/1584625#M45563</link>
    <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Great catch! Switching between too many programming languages has its quirks!&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
    <pubDate>Wed, 12 Feb 2025 20:38:19 GMT</pubDate>
    <dc:creator>CodyPatterson</dc:creator>
    <dc:date>2025-02-12T20:38:19Z</dc:date>
    <item>
      <title>Field Calculate taking hours to run on less than 20000 feature?</title>
      <link>https://community.esri.com/t5/data-management-questions/field-calculate-taking-hours-to-run-on-less-than/m-p/1584595#M45559</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am running an arcade script on my Building Footprint Layer that takes all the points (Addresses) within, and concatenates them into a string and puts the values into a field. (see below)&lt;/P&gt;&lt;P&gt;However, this particular script is taking hours to run?&lt;/P&gt;&lt;P&gt;Data is within the same sde, in a SQL database, working in ArcPro 3.3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// Retrieve the ADDRESS feature set
var address_fc = FeatureSetByName($datastore, "DBO.MasterAddress", ['Address_Full', 'AddressType'], true);

// Initialize a string to store the Address_Full values
var address_string = "";

// Loop through the addresses and check if they are within the current building polygon
for (var addr in address_fc) {
    // Check if the address is within the current building polygon and has AddressType = "Address"
    if (Within(addr, $feature) &amp;amp;&amp;amp; addr.AddressType == "Address") {
        // If this is not the first address, add a comma separator
        if (address_string != "") {
            address_string += ", ";  // Add comma separator
        }
        // Concatenate the address to the address_string
        address_string += addr.Address_Full;
    }
}

// Return the collected addresses as a comma-separated string
return address_string;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2025 19:32:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/field-calculate-taking-hours-to-run-on-less-than/m-p/1584595#M45559</guid>
      <dc:creator>Amarz</dc:creator>
      <dc:date>2025-02-12T19:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculate taking hours to run on less than 20000 feature?</title>
      <link>https://community.esri.com/t5/data-management-questions/field-calculate-taking-hours-to-run-on-less-than/m-p/1584613#M45560</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/528032"&gt;@Amarz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This could be because you're filtering through all of your addresses while also making calls to the Within function, once done, it creates a new string each time, your run time for this would be O(N * M + N * K) which is quite large if speaking in asymptotic terms.&lt;/P&gt;&lt;P&gt;Consider this program here:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var address_fc = Intersects(FeatureSetByName($datastore, "DBO.MasterAddress", ['Address_Full', 'AddressType'], true), $feature);

var address_list = [];

for (var addr in address_fc) {
    if (addr.AddressType == "Address") {
        address_list.Push(addr.Address_Full);
    }
}

return Concatenate(address_list, ", ");&lt;/LI-CODE&gt;&lt;P&gt;The main differences is that there's a checking of only the relevant addresses with intersects, and within may run per-iteration, something that could take forever. If I did this correctly and get the growth correctly, this is O(N + B * K), which is N number of addresses + B number of filtered intersecting addresses, finally multiplied by K concatenation.&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2025 20:06:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/field-calculate-taking-hours-to-run-on-less-than/m-p/1584613#M45560</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2025-02-12T20:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculate taking hours to run on less than 20000 feature?</title>
      <link>https://community.esri.com/t5/data-management-questions/field-calculate-taking-hours-to-run-on-less-than/m-p/1584620#M45561</link>
      <description>&lt;P&gt;Thank you for the explanation&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/712076"&gt;@CodyPatterson&lt;/a&gt;. The code validates, but I am getting the error&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;ERROR 002717: Invalid Arcade expression, Arcade error: Integer index expected, Script line: 7&lt;/LI-CODE&gt;&lt;P&gt;when attempting to run it. Any further help is apprecaited.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2025 20:16:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/field-calculate-taking-hours-to-run-on-less-than/m-p/1584620#M45561</guid>
      <dc:creator>Amarz</dc:creator>
      <dc:date>2025-02-12T20:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculate taking hours to run on less than 20000 feature?</title>
      <link>https://community.esri.com/t5/data-management-questions/field-calculate-taking-hours-to-run-on-less-than/m-p/1584622#M45562</link>
      <description>&lt;P&gt;That line should be&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Push(address_list, addr.Address_Full)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 12 Feb 2025 20:28:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/field-calculate-taking-hours-to-run-on-less-than/m-p/1584622#M45562</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2025-02-12T20:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculate taking hours to run on less than 20000 feature?</title>
      <link>https://community.esri.com/t5/data-management-questions/field-calculate-taking-hours-to-run-on-less-than/m-p/1584625#M45563</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Great catch! Switching between too many programming languages has its quirks!&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2025 20:38:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/field-calculate-taking-hours-to-run-on-less-than/m-p/1584625#M45563</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2025-02-12T20:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculate taking hours to run on less than 20000 feature?</title>
      <link>https://community.esri.com/t5/data-management-questions/field-calculate-taking-hours-to-run-on-less-than/m-p/1584629#M45564</link>
      <description>&lt;P&gt;So how long does it now take for your updated script to run?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2025 20:47:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/field-calculate-taking-hours-to-run-on-less-than/m-p/1584629#M45564</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2025-02-12T20:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculate taking hours to run on less than 20000 feature?</title>
      <link>https://community.esri.com/t5/data-management-questions/field-calculate-taking-hours-to-run-on-less-than/m-p/1584687#M45566</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/712076"&gt;@CodyPatterson&lt;/a&gt;&amp;nbsp;&amp;amp;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;for the assistance! Is there a way to add something that will return a null value if the Building Footprint doesn't have an address on it? Or is that already built in?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2025 22:39:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/field-calculate-taking-hours-to-run-on-less-than/m-p/1584687#M45566</guid>
      <dc:creator>Amarz</dc:creator>
      <dc:date>2025-02-12T22:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: Field Calculate taking hours to run on less than 20000 feature?</title>
      <link>https://community.esri.com/t5/data-management-questions/field-calculate-taking-hours-to-run-on-less-than/m-p/1584688#M45567</link>
      <description>&lt;P&gt;Well, not sure what happened. Ran for 1.5 hours and got the dreaded 9999 Error.. so I am attempting to run again.&lt;/P&gt;&lt;P&gt;The Error is due to the array exceeding the character count of the field on some buildings, so I am doing going in smaller batches and will manually edit the features or the field to reflect the correct address.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2025 00:13:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/field-calculate-taking-hours-to-run-on-less-than/m-p/1584688#M45567</guid>
      <dc:creator>Amarz</dc:creator>
      <dc:date>2025-02-13T00:13:29Z</dc:date>
    </item>
  </channel>
</rss>

