<?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: Calculation Attribute Rule Fails with Domains in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/calculation-attribute-rule-fails-with-domains/m-p/1506390#M85663</link>
    <description>&lt;P&gt;It appears the fix for this was simply checking "Exclude From Client Evaluation" box within the Attribute Rules interface for this particular rule.&lt;/P&gt;&lt;P&gt;I still need to read through the post here (entitled &lt;STRONG&gt;Attribute Rules - Exclude from Application Evaluation&lt;/STRONG&gt;) to fully understand why that is though.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/attribute-rules-blog/attribute-rules-exclude-from-application/ba-p/1016604" target="_blank"&gt;Attribute Rules - Exclude from Application Evaluat... - Esri Community&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Jul 2024 21:57:26 GMT</pubDate>
    <dc:creator>VinceE</dc:creator>
    <dc:date>2024-07-17T21:57:26Z</dc:date>
    <item>
      <title>Calculation Attribute Rule Fails with Domains</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculation-attribute-rule-fails-with-domains/m-p/1506368#M85659</link>
      <description>&lt;P&gt;I am trying to write an Attribute Rule that calculates the value in FieldA over to the value in FieldB. Both fields have the same Domain applied (domain named "TwoOptions"), and that Domain has two codes: {OPT1: Option1, OPT2: Option2}.&lt;/P&gt;&lt;P&gt;Here is the Field View, followed by the Domain.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VinceE_0-1721250197762.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109984i9B7FA1BE712E20AF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="VinceE_0-1721250197762.png" alt="VinceE_0-1721250197762.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VinceE_1-1721250250253.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109985iFE8791CCB824CE72/image-size/medium?v=v2&amp;amp;px=400" role="button" title="VinceE_1-1721250250253.png" alt="VinceE_1-1721250250253.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Code below is a bit over-engineered because it's from a general template I try to follow.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// INPUTS
var inputFldVal = $feature.FieldA

// OUTPUTS
var outputFldName = "FieldB"

//---------------------------------------------------------------------//
// FUNCTIONS
function directCopyCalculation(inputFldVal) {
    /* If value exists in input column, copy to results dictionary for output column.*/
    var result = Dictionary("VALUE", null, "ERROR", null)

    // CHECK 1: Value in origin field exists.
    if (IsEmpty(inputFldVal))
        {return result}

    result["VALUE"] = inputFldVal
    return result
}

//---------------------------------------------------------------------//
// MAIN
var fldUpdates = Dictionary()

var result = directCopyCalculation(inputFldVal)
if (!IsEmpty(result["ERROR"]))
    // If any errors were found, return dict without any field updates.
    {return {"errorMessage": `ERROR: ${result}`}}
else
    // If no errors, update the results dict with the value for the new field.
    {fldUpdates[outputFldName] = result["VALUE"]}

Console(`RETURNING: ${{"result": {"attributes": fldUpdates}}}`)
return {"result": {"attributes": fldUpdates}}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;It works fine when selecting &amp;lt;Null&amp;gt; or either of the domain options in FieldA. Trying to update FieldB results in FieldB automatically updating back to whatever the value in FieldA is, which is fine and expected.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VinceE_2-1721250439578.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109986i14337A1A3D91800A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="VinceE_2-1721250439578.png" alt="VinceE_2-1721250439578.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If I intentionally break the Domain in FieldA using Field Calculator to populate an invalid value, that value also calculates over to FieldB. This is also fine, and what I would expect.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VinceE_3-1721250533518.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109987i75FFFC23D0C6E754/image-size/medium?v=v2&amp;amp;px=400" role="button" title="VinceE_3-1721250533518.png" alt="VinceE_3-1721250533518.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The problem arises if I try to manually change FieldA back to a valid value. I get the following error. Hitting "OK" reverts FieldA's value back to "VALUE OUTSIDE DOMAIN".&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VinceE_4-1721250623589.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109988i5457F24331EEC2D1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="VinceE_4-1721250623589.png" alt="VinceE_4-1721250623589.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Seems like FieldB is being validated for allowable domain values BEFORE the newly updated valid value from FieldA is calculated over to FieldB. Am I missing an order-of-calculations thing here? Something else?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2024 21:20:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculation-attribute-rule-fails-with-domains/m-p/1506368#M85659</guid>
      <dc:creator>VinceE</dc:creator>
      <dc:date>2024-07-17T21:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Attribute Rule Fails with Domains</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculation-attribute-rule-fails-with-domains/m-p/1506390#M85663</link>
      <description>&lt;P&gt;It appears the fix for this was simply checking "Exclude From Client Evaluation" box within the Attribute Rules interface for this particular rule.&lt;/P&gt;&lt;P&gt;I still need to read through the post here (entitled &lt;STRONG&gt;Attribute Rules - Exclude from Application Evaluation&lt;/STRONG&gt;) to fully understand why that is though.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/attribute-rules-blog/attribute-rules-exclude-from-application/ba-p/1016604" target="_blank"&gt;Attribute Rules - Exclude from Application Evaluat... - Esri Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2024 21:57:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculation-attribute-rule-fails-with-domains/m-p/1506390#M85663</guid>
      <dc:creator>VinceE</dc:creator>
      <dc:date>2024-07-17T21:57:26Z</dc:date>
    </item>
  </channel>
</rss>

