<?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: How to automatically update features with arcade calculated expressions in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/how-to-automatically-update-features-with-arcade/m-p/1550334#M1600</link>
    <description>&lt;P&gt;Hi Mike, thank you very much for pointing me in the right direction.&lt;BR /&gt;Looks like I need to use the example in the update section, but I need a global or objectID:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;return&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; "result"&lt;/SPAN&gt;&lt;SPAN&gt;: $feature.assetid,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; "edit"&lt;/SPAN&gt;&lt;SPAN&gt;: [{&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "className"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN class=""&gt;"electricdistributionassembly"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "updates"&lt;/SPAN&gt;&lt;SPAN&gt;: [{&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "objectID"&lt;/SPAN&gt;&lt;SPAN&gt;: feature_objectid,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "associationType"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN class=""&gt;'container'&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }]&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }]&lt;BR /&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;To make sure, this would work in AGOL field maps editor?&amp;nbsp; Would I just pull the current objectID within the code?&lt;BR /&gt;To further clarify also, other calculated fields update automatically, like the "Freight Access Leg Direction Score" shown in the picture. But this field does not since its calculation involves other points.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is below in case it helps. It looks around for other features, but as I mentioned it requires me to update each point after one point is modified.&lt;BR /&gt;please forgive my lack of coding skill.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;// get the current project and intersection name&lt;BR /&gt;var currentProj = $feature.Project;&lt;BR /&gt;var currentIntx = $feature.Intersection;&lt;BR /&gt;&lt;BR /&gt;// Filter through the other points that have the same project and intersection name&lt;BR /&gt;var matchingProj = Filter($layer, "Project = '" + currentProj + "' AND Intersection = '" + currentIntx + "'");&lt;BR /&gt;&lt;BR /&gt;// get list of all different cardinal directions within the filtered points&lt;BR /&gt;var allDirections = Distinct(matchingProj, "LegDirection");&lt;BR /&gt;&lt;BR /&gt;// set initial total denmoniator of scoring ratio to 0&lt;BR /&gt;var totalSumDenominator = 0;&lt;BR /&gt;&lt;BR /&gt;// set highest possible score values of different fields&lt;BR /&gt;var fieldsAndScores = {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Freight_VerticalClearance: 2,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Freight_CornerTurningRadii: 1,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Freight_TruckTurningMovement: 2,&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;// loop through each direction within the filter to get the total denominator&lt;BR /&gt;for (var f in allDirections) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; var currentDir = f.LegDirection;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; var filteredFeatures = Filter(matchingProj, "LegDirection = '" + currentDir + "'");&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; for (var feat in filteredFeatures) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var sumDenominator = 0;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (var field in fieldsAndScores) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (!IsEmpty(feat[field])) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sumDenominator += fieldsAndScores[field];&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; totalSumDenominator += sumDenominator;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;// Add all values of the Freight Score for all features in the filter to get the numerator&lt;BR /&gt;var totalIntFreightScore = Sum(matchingProj, "Freight_AcessLegDirScore");&lt;BR /&gt;&lt;BR /&gt;// if there is a score, divide the total score divided by total possible score&lt;BR /&gt;if (totalSumDenominator &amp;gt; 0) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; return Round(((totalIntFreightScore / totalSumDenominator) * 100), 2);&lt;BR /&gt;} else {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; return 0; // Default value if the denominator is zero&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Mon, 21 Oct 2024 09:05:51 GMT</pubDate>
    <dc:creator>JamesPoeschel</dc:creator>
    <dc:date>2024-10-21T09:05:51Z</dc:date>
    <item>
      <title>How to automatically update features with arcade calculated expressions</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/how-to-automatically-update-features-with-arcade/m-p/1549851#M1598</link>
      <description>&lt;P&gt;I have features with calculated expressions that take values from nearby points and produce a shared final score. The issue I am facing is that when an additional point is created or one point is edited, all the other points need to be selected individually to be updated. In the picture below, there are four black points for each leg of an intersection. After each point is created and their forms are completed, the user has to go back and click each point individually to reupdate each point once again. Since any change to one point affects all 4.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JamesPoeschel_0-1729246138443.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/117519iCEF5F04A9608DD65/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JamesPoeschel_0-1729246138443.png" alt="JamesPoeschel_0-1729246138443.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am wondering if there is a way to add to the arcade code to automatically update. Or any other workarounds that would solve this problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2024 10:19:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/how-to-automatically-update-features-with-arcade/m-p/1549851#M1598</guid>
      <dc:creator>JamesPoeschel</dc:creator>
      <dc:date>2024-10-18T10:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically update features with arcade calculated expressions</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/how-to-automatically-update-features-with-arcade/m-p/1549873#M1599</link>
      <description>&lt;P&gt;Using an attribute rule, yes you can.&amp;nbsp; You can find all points in a distance and trigger an edit on that feature, so its attribute rule fire or calculate the value and set it on that feature.&lt;/P&gt;
&lt;P&gt;You want to look at the return edits keywords:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-keywords.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-keywords.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2024 12:50:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/how-to-automatically-update-features-with-arcade/m-p/1549873#M1599</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2024-10-18T12:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically update features with arcade calculated expressions</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/how-to-automatically-update-features-with-arcade/m-p/1550334#M1600</link>
      <description>&lt;P&gt;Hi Mike, thank you very much for pointing me in the right direction.&lt;BR /&gt;Looks like I need to use the example in the update section, but I need a global or objectID:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN class=""&gt;return&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; "result"&lt;/SPAN&gt;&lt;SPAN&gt;: $feature.assetid,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; "edit"&lt;/SPAN&gt;&lt;SPAN&gt;: [{&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "className"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN class=""&gt;"electricdistributionassembly"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "updates"&lt;/SPAN&gt;&lt;SPAN&gt;: [{&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "objectID"&lt;/SPAN&gt;&lt;SPAN&gt;: feature_objectid,&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "associationType"&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN class=""&gt;'container'&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }]&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }]&lt;BR /&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;To make sure, this would work in AGOL field maps editor?&amp;nbsp; Would I just pull the current objectID within the code?&lt;BR /&gt;To further clarify also, other calculated fields update automatically, like the "Freight Access Leg Direction Score" shown in the picture. But this field does not since its calculation involves other points.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is below in case it helps. It looks around for other features, but as I mentioned it requires me to update each point after one point is modified.&lt;BR /&gt;please forgive my lack of coding skill.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;// get the current project and intersection name&lt;BR /&gt;var currentProj = $feature.Project;&lt;BR /&gt;var currentIntx = $feature.Intersection;&lt;BR /&gt;&lt;BR /&gt;// Filter through the other points that have the same project and intersection name&lt;BR /&gt;var matchingProj = Filter($layer, "Project = '" + currentProj + "' AND Intersection = '" + currentIntx + "'");&lt;BR /&gt;&lt;BR /&gt;// get list of all different cardinal directions within the filtered points&lt;BR /&gt;var allDirections = Distinct(matchingProj, "LegDirection");&lt;BR /&gt;&lt;BR /&gt;// set initial total denmoniator of scoring ratio to 0&lt;BR /&gt;var totalSumDenominator = 0;&lt;BR /&gt;&lt;BR /&gt;// set highest possible score values of different fields&lt;BR /&gt;var fieldsAndScores = {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Freight_VerticalClearance: 2,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Freight_CornerTurningRadii: 1,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Freight_TruckTurningMovement: 2,&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;// loop through each direction within the filter to get the total denominator&lt;BR /&gt;for (var f in allDirections) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; var currentDir = f.LegDirection;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; var filteredFeatures = Filter(matchingProj, "LegDirection = '" + currentDir + "'");&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; for (var feat in filteredFeatures) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var sumDenominator = 0;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (var field in fieldsAndScores) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (!IsEmpty(feat[field])) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sumDenominator += fieldsAndScores[field];&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; totalSumDenominator += sumDenominator;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;// Add all values of the Freight Score for all features in the filter to get the numerator&lt;BR /&gt;var totalIntFreightScore = Sum(matchingProj, "Freight_AcessLegDirScore");&lt;BR /&gt;&lt;BR /&gt;// if there is a score, divide the total score divided by total possible score&lt;BR /&gt;if (totalSumDenominator &amp;gt; 0) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; return Round(((totalIntFreightScore / totalSumDenominator) * 100), 2);&lt;BR /&gt;} else {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; return 0; // Default value if the denominator is zero&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2024 09:05:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/how-to-automatically-update-features-with-arcade/m-p/1550334#M1600</guid>
      <dc:creator>JamesPoeschel</dc:creator>
      <dc:date>2024-10-21T09:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically update features with arcade calculated expressions</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/how-to-automatically-update-features-with-arcade/m-p/1550404#M1601</link>
      <description>&lt;P&gt;Please post code as a code snippet:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Code Comments:
&lt;UL&gt;
&lt;LI&gt;Use $FeatureSet
&lt;UL&gt;
&lt;LI&gt;I think you need to use $FeatureSet, as an attribute rule profile cannot use $layer&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;var matchingProj = Filter($layer, "Project = '" + currentProj + "' AND Intersection = '" + currentIntx + "'");&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;to&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;var matchingProj = Filter($featureSet, "Project = '" + currentProj + "' AND Intersection = '" + currentIntx + "'");&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;For the sql, best to use the&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/696824"&gt;@Variable80&lt;/a&gt; syntax
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN&gt;"Project = '" + currentProj + "' AND Intersection = '" + currentIntx + "'");&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;"Project = @currentProj AND Intersection = @currentIntx");&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;I am confused by the Distinct call to get the leg directions and then more filtering of the data.&amp;nbsp; I think this could be simplified.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;LI-CODE lang="javascript"&gt;for (var feat in matchingProj){
	if (IsNull(feat.LegDirection)){
		continue
	}
	var sumDenominator = 0;
    for (var field in fieldsAndScores) {
		if (!IsEmpty(feat[field])) {
			sumDenominator += fieldsAndScores[field];
		}
	}        

    totalSumDenominator += sumDenominator;
    
}&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you want to do is get all the OIDs or GlobalID of the features you want to update.&amp;nbsp; You are looping over them, so store them into a list/array.&lt;/P&gt;
&lt;P&gt;When done, convert that list into a list of dictionaries, with the globalid and an attributes keyword, with the field you wish to update in it&lt;/P&gt;
&lt;P&gt;Since this is an attribute rule, it always fires in the database, so it will work no matter what client does the edits.&amp;nbsp; Some client are not aware of the return edit payload from apply edits(instead of the edit just returning success, it returns the others features that were edited so it can do a refresh).&amp;nbsp; So if the client is not reading the return edits, you just need to refresh to see the other updates.&lt;/P&gt;
&lt;P&gt;The return edit statement you want is the Updates:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;return {
    'edit': [{
        'className': 'b_edit_dict',
        'updates': [{
            'globalID': '{7EBAB596-E9DB-40D8-9756-B2EBED2500B7}',
            'attributes': {
                'field_name': 22
            }
        }]
    }]
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Oct 2024 12:30:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/how-to-automatically-update-features-with-arcade/m-p/1550404#M1601</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2024-10-21T12:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically update features with arcade calculated expressions</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/how-to-automatically-update-features-with-arcade/m-p/1550484#M1603</link>
      <description>&lt;P&gt;Thank you, that is a big help. I think I'm getting much closer now. I don't get an error when in the code tester, but when editing a feature in the web map, it wont let me update the layer.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JamesPoeschel_0-1729523277940.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/117683iED12E0AFA468C571/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JamesPoeschel_0-1729523277940.png" alt="JamesPoeschel_0-1729523277940.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var currentProj = $feature.Project;
var currentIntx = $feature.Intersection;
var matchingProj = Filter($featureSet, "Project = @currentProj AND Intersection = @currentIntx");

var totalSumDenominator = 0;

var fieldsAndScores = {
    Freight_VerticalClearance: 2,
    Freight_CornerTurningRadii: 1,
    Freight_TruckTurningMovement: 2,
    Freight_OnStreetParking: 1,
    Freight_DesignatedFreightRout: 2
};

var listOID = [];
var index = 0; 
var attributesList = []; // Initialize an empty array for dictionaries

for (var feat in matchingProj){
    listOID[index] = feat.OBJECTID;
    index += 1;  // Increment the index

	if (IsNan(feat.LegDirection)){
		continue
	}
	var sumDenominator = 0;
    for (var field in fieldsAndScores) {
		if (!IsEmpty(feat[field])) {
			sumDenominator += fieldsAndScores[field];
		}
	}        

    totalSumDenominator += sumDenominator;
    
}

Console("List of OIDs: " + listOID);

// Add all values of the IntPedADAScore for all features in the filter
var totalIntFreightScore = Sum(matchingProj, "Freight_AcessLegDirScore");
    
// if (totalSumDenominator &amp;gt; 0) {
//     var FinalScore = Round(((totalIntFreightScore / totalSumDenominator) * 100), 2);
//     return FinalScore;
// } else {
//     return 0; // Default value if the denominator is zero
// }

var FinalScore = Round(((totalIntFreightScore / totalSumDenominator) * 100), 2);

// Convert the listOID into a list of dictionaries
for (var oid in listOID) {
    var attrDict = {
        "OBJECTID": listOID[oid],
        "Freight_AccessTotalScore": FinalScore
    };
    
    // Use the length of attributesList to append the new dictionary
    attributesList[Count(attributesList)] = attrDict;  
}

Console("List of Attributes: " + attributesList);

return {
    'edit': [{
        'className': FeatureSetById($map, "19130248331-layer-8"),
        'updates': [{
            attributesList
        }]
    }]
}&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 21 Oct 2024 15:10:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/how-to-automatically-update-features-with-arcade/m-p/1550484#M1603</guid>
      <dc:creator>JamesPoeschel</dc:creator>
      <dc:date>2024-10-21T15:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically update features with arcade calculated expressions</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/how-to-automatically-update-features-with-arcade/m-p/1550553#M1604</link>
      <description>You are creating an attribute rule, right?  That looks like you are using a form calculation rule, which does not support DML(editing other features)&lt;BR /&gt;</description>
      <pubDate>Mon, 21 Oct 2024 17:49:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/how-to-automatically-update-features-with-arcade/m-p/1550553#M1604</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2024-10-21T17:49:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to automatically update features with arcade calculated expressions</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/how-to-automatically-update-features-with-arcade/m-p/1550740#M1605</link>
      <description>&lt;P&gt;To be honest, I am not 100% sure. I am pretty new. This is a calculated expression being applied to a form within field maps. Perhaps I should have posted this in the AGOL forum? Or is what I am trying to do not possible.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 04:02:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/how-to-automatically-update-features-with-arcade/m-p/1550740#M1605</guid>
      <dc:creator>JamesPoeschel</dc:creator>
      <dc:date>2024-10-22T04:02:01Z</dc:date>
    </item>
  </channel>
</rss>

