<?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: Attribute Rule - Calculation Type - Not working in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/attribute-rule-calculation-type-not-working/m-p/1112966#M7422</link>
    <description>&lt;P&gt;Thank you so much! This worked. Accepting as solution.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Nov 2021 19:51:14 GMT</pubDate>
    <dc:creator>Raj-Chavada</dc:creator>
    <dc:date>2021-11-01T19:51:14Z</dc:date>
    <item>
      <title>Attribute Rule - Calculation Type - Not working</title>
      <link>https://community.esri.com/t5/geodatabase-questions/attribute-rule-calculation-type-not-working/m-p/1112576#M7418</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;We have two feature classes A &amp;amp; B in enterprise geodatabase environment. They are participating in a relationship class.&lt;/P&gt;&lt;P&gt;A - Projects&lt;/P&gt;&lt;P&gt;B- Sewer upgrades&lt;/P&gt;&lt;P&gt;Our goal/requirement is to automatically update the common attributes on existing features in B if the same attribute fields are updates in A.&amp;nbsp;&lt;/P&gt;&lt;P&gt;To accomplish this, base on the example available here, I came up with following (immediate calculation rule on A):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;//s1 - get all the features from sewer upgrades feature class
var destination = FeatureSetByName($datastore, "GEO_DB.ENG_SD.SewerUpgrade", ["DBNUMBER","TECH_REV", "CONS_ST", "CONS_ED", "EST_CON_DUR", "STATUS"], false);

//s2 - get dbnumber edited in the projects developments feature class
var dbnumber = $feature.DBNUMBER;

//s3 - filter feature based on the existing edit 
var match = Filter(destination, "DBNUMBER = @dbnumber");

//s4 - update records in sewer upgrades
var sewerupgradelist = [];
var counter = 0;
var numfeatures = Count(match);

if (numfeatures &amp;gt; 0) {
    for (var feature in match)  {
           sewerupgradelist[counter] = {
                'OBJECTID' : feature.OBJECTID,
                'attributes' : {
                         'CONS_ST' : $feature.CONS_ST,
                         'CONS_ED' : $feature.CONS_ED,
                     'EST_CON_DUR' : $feature.EST_CONS_DUR,
                        'TECH_REV' : $feature.TECH_REV,
                          'STATUS' : $feature.STATUS 
                        }
                     }
                     counter++
                  }
                  return {
                         'result' : numfeatures + ' sewer upgrades features found.',
                          'edit' : [{
                               'className' :  "GEO_DB.ENG_SD.SewerUpgrade",
                                'updates' :   sewerupgradelist
                             }]
                      }
                   

  }else {
    return 'No features found under sewer upgrade with matching DBNUMBER.'
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While there are no validation errors, ArcGIS Pro comes up with following error during testing:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RajChavada_0-1635542042816.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/26482i116DA25B6D1D5CF8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RajChavada_0-1635542042816.png" alt="RajChavada_0-1635542042816.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help in resolving the issue will be appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Oct 2021 22:21:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/attribute-rule-calculation-type-not-working/m-p/1112576#M7418</guid>
      <dc:creator>Raj-Chavada</dc:creator>
      <dc:date>2021-10-29T22:21:35Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule - Calculation Type - Not working</title>
      <link>https://community.esri.com/t5/geodatabase-questions/attribute-rule-calculation-type-not-working/m-p/1112582#M7419</link>
      <description>&lt;P&gt;Hello Raj-Chavada,&lt;/P&gt;&lt;P&gt;I'm not sure this is the reason for the error message, but I see something I'd like to ask about:&lt;/P&gt;&lt;P&gt;At Line 2, in your field list, I see 6 fields: "DBNUMBER", "TECH_REV", "CONS_ST", "CONS_ED, "EST_CON_DUR", and "STATUS"&lt;/P&gt;&lt;P&gt;In Lines 20-25, I see 6 fields: 'CONS_ST', 'CONS_ED', 'CONS_ST', 'EST_CON_DUR', 'TECH_REC', and 'STATUS'&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;In these lines of code, 'CONS_ST' is referenced 2x while 'DBNUMBER' is not referenced.&lt;/LI&gt;&lt;LI&gt;Is this by design?&lt;/LI&gt;&lt;LI&gt;Is it possible 'DBNUMBER' is meant to be referenced, but the 2x 'CONT_ST' is causing confusion, and that is the reason for the error?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;What do you think?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Oct 2021 21:38:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/attribute-rule-calculation-type-not-working/m-p/1112582#M7419</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-10-29T21:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule - Calculation Type - Not working</title>
      <link>https://community.esri.com/t5/geodatabase-questions/attribute-rule-calculation-type-not-working/m-p/1112589#M7420</link>
      <description>&lt;P&gt;Thanks, Mike! Please see my reply below:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;In these lines of code, 'CONS_ST' is referenced 2x while 'DBNUMBER' is not referenced. Is this by design?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;RC: No. This is an error on my part. Removed the extra line.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Is it possible 'DBNUMBER' is meant to be referenced, but the 2x 'CONT_ST' is causing confusion, and that is the reason for the error?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;RC: I am not referencing 'DBNUMBER' because that attribute field not required to be updated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Oct 2021 22:20:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/attribute-rule-calculation-type-not-working/m-p/1112589#M7420</guid>
      <dc:creator>Raj-Chavada</dc:creator>
      <dc:date>2021-10-29T22:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule - Calculation Type - Not working</title>
      <link>https://community.esri.com/t5/geodatabase-questions/attribute-rule-calculation-type-not-working/m-p/1112762#M7421</link>
      <description>&lt;P&gt;According to the&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-keywords.htm" target="_blank" rel="noopener"&gt;documentation of the attribute rule dicitonary keywords&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;the "result" field in the returned dictionary is either&lt;UL&gt;&lt;LI&gt;a value for the field definied as return field for the rule&lt;/LI&gt;&lt;LI&gt;a dicitionary for the geometry and/or attributes of the feature, if you haven't set a return field in the rule&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;You return a log message. If you haven't set a text field as output field of the rule, this should throw an error.&lt;/LI&gt;&lt;LI&gt;The ObjectID in the update array should be given in the dictionary field "objectID", not "OBJECTID", don't know if this would cause an error, though.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, try this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//s1 - get all the features from sewer upgrades feature class
// you only need DBNUMBER (to filter) and OBJECTID (to send edits)
var destination = FeatureSetByName($datastore, "GEO_DB.ENG_SD.SewerUpgrade", ["DBNUMBER","OBJECTID"], false);

//s2 - get dbnumber edited in the projects developments feature class
var dbnumber = $feature.DBNUMBER;

//s3 - filter feature based on the existing edit 
var match = Filter(destination, "DBNUMBER = @dbnumber");

//s4 - update records in sewer upgrades
var sewerupgradelist = [];
var counter = 0;

for (var feature in match)  {
    sewerupgradelist[counter] = {
        'objectID' : feature.OBJECTID,
        'attributes' : {
            'CONS_ST' : $feature.CONS_ST,
            'CONS_ED' : $feature.CONS_ED,
            'EST_CON_DUR' : $feature.EST_CONS_DUR,
            'TECH_REV' : $feature.TECH_REV,
            'STATUS' : $feature.STATUS 
        }
    }
    counter++
}
return {
// only use this if you have set a text field as return field for the rule
//    'result' : numfeatures + ' sewer upgrades features found.',
    'edit' : [{
        'className' :  "GEO_DB.ENG_SD.SewerUpgrade",
        'updates' :   sewerupgradelist
    }]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 06:33:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/attribute-rule-calculation-type-not-working/m-p/1112762#M7421</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2021-11-01T06:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule - Calculation Type - Not working</title>
      <link>https://community.esri.com/t5/geodatabase-questions/attribute-rule-calculation-type-not-working/m-p/1112966#M7422</link>
      <description>&lt;P&gt;Thank you so much! This worked. Accepting as solution.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Nov 2021 19:51:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/attribute-rule-calculation-type-not-working/m-p/1112966#M7422</guid>
      <dc:creator>Raj-Chavada</dc:creator>
      <dc:date>2021-11-01T19:51:14Z</dc:date>
    </item>
  </channel>
</rss>

