<?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: Automating Parking Capacity Calculation and Updates for Shared GUIDs in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/automating-parking-capacity-calculation-and/m-p/1332246#M1131</link>
    <description>Blockface is a featureset, you need to filter it to get to a feature&lt;BR /&gt;</description>
    <pubDate>Tue, 26 Sep 2023 02:43:45 GMT</pubDate>
    <dc:creator>MikeMillerGIS</dc:creator>
    <dc:date>2023-09-26T02:43:45Z</dc:date>
    <item>
      <title>Automating Parking Capacity Calculation and Updates for Shared GUIDs</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/automating-parking-capacity-calculation-and/m-p/1332167#M1130</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;Wondering if I could get some help with this rule.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;"x.DBO.CapacityBlockface" &lt;/STRONG&gt;- Contains a GUID field ['Blockface_GUID'] and a null count field ['Capacity'] to be populated by this rule.&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;"&lt;/EM&gt;x.DBO.StreetParking"&lt;/STRONG&gt; has a GUID field, ['Blockface_GUID,'] which is auto-populated by an attribute rule that identifies the nearest "CapacityBlockface" GUID through a buffer and intersect operation. Additionally, it includes a field called ['NumberCars'], which is populated by an attribute rule that calculates the number of cars that can fit within that segment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I would like this rule to do is - on the insert, update, or delete of a "StreetParking" feature, I want it to automatically calculate the number of available parking spots between all features that share a GUID. When it calculates the total, I want it to write to the "CapacityBlockface" feature that shares that GUID.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;BR /&gt;Three "StreetParking" segments (orange) contain different available parking based on length. They also contain the same GIUD (11E6 - last 4 of GUID) as the "CapacityBlockface" (white). On the insert, update, or delete of a "StreetParking" feature, I want the total number of cars between all that share a GUID to be pushed to the blockface feature field ['Capacity']. Therefore 11E6 will have 10 cars.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-09-25 164944.png" style="width: 879px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/81576i52166F3BEF71EBC5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2023-09-25 164944.png" alt="Screenshot 2023-09-25 164944.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Using this code, I can return the total number of cars through console, but I am running into issue when trying to return it to the "CapacityBlockface" layer. I get the error "Dictionary Type Expected"&amp;nbsp; on the GlobalID on line 18.&lt;/P&gt;&lt;P&gt;Any input would be greatly appreciated!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markdown"&gt;var blockface = FeatureSetByName($datastore, "x.DBO.CapacityBlockface", ["Blockface_GUID", "Capacity", "GlobalID"], false)
var parking = FeatureSetByName($datastore,"x.DBO.StreetParking",["Blockface_GUID", "NumberCars"],false)

var parking_GUID = $feature.Blockface_GUID
var sql = 'Blockface_GUID LIKE @parking_GUID'

var masterFilter = Filter(parking,sql)

var countCars = 0
for(var i in masterFilter){
countCars += i.NumberCars
}

return {
    'edit': [{
        'className': "x.DBO.CapacityBlockface",
        'updates': [{
            'GlobalID': blockface.GlobalID,
            'attributes': {
                'Capacity': 'countCars'
            }
        }]
    }]
}&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>Mon, 25 Sep 2023 21:09:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/automating-parking-capacity-calculation-and/m-p/1332167#M1130</guid>
      <dc:creator>JacobWeston1</dc:creator>
      <dc:date>2023-09-25T21:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: Automating Parking Capacity Calculation and Updates for Shared GUIDs</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/automating-parking-capacity-calculation-and/m-p/1332246#M1131</link>
      <description>Blockface is a featureset, you need to filter it to get to a feature&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Sep 2023 02:43:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/automating-parking-capacity-calculation-and/m-p/1332246#M1131</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2023-09-26T02:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: Automating Parking Capacity Calculation and Updates for Shared GUIDs</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/automating-parking-capacity-calculation-and/m-p/1332413#M1132</link>
      <description>&lt;P&gt;Thank you Mike!&lt;/P&gt;&lt;P&gt;This is what I got working.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var blockface = FeatureSetByName($datastore, "x.DBO.CapacityBlockface", ["Blockface_GUID", "Capacity", "GlobalID"], false);
var parking = FeatureSetByName($datastore, "x.DBO.StreetParking", ["Blockface_GUID", "NumberCars"], false);

var parking_GUID = $feature.Blockface_GUID;
var sql = 'Blockface_GUID = @parking_GUID';

var filterParking = Filter(parking, sql);
var filterBlockface = Filter(blockface, sql);

var sumCars = 0;
for (var i in filterParking) {
    sumCars += i.NumberCars;
}

var filterblockface_GlobalID = "";
for (var i in filterBlockface) {
filterblockface_GlobalID = i.GlobalID;
}

return {
    'edit': [{
        'className': "x.DBO.CapacityBlockface",
        'updates': [{
            'GlobalID': filterblockface_GlobalID,
            'attributes': {
                'Capacity': sumCars
            }
        }]
    }]
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2023 14:20:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/automating-parking-capacity-calculation-and/m-p/1332413#M1132</guid>
      <dc:creator>JacobWeston1</dc:creator>
      <dc:date>2023-09-26T14:20:07Z</dc:date>
    </item>
  </channel>
</rss>

