<?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: I am trying to create attribute rules in arcade for 2 branch versioned feature classes in a relationship class. in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1551913#M89456</link>
    <description>&lt;P&gt;With that change I still get the same error. hmm&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Oct 2024 15:38:12 GMT</pubDate>
    <dc:creator>JeffTimm</dc:creator>
    <dc:date>2024-10-24T15:38:12Z</dc:date>
    <item>
      <title>I am trying to create attribute rules in arcade for 2 branch versioned feature classes in a relationship class.</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1551888#M89453</link>
      <description>&lt;DIV class=""&gt;&lt;P&gt;When I update site_p I want the correlating fields in site_a to be updated as well. The relationship class is realated on the field "rpsuid"&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;// Step 1: Get the related records from site_a using the correct relationship class name
var relatedRecords = FeatureSetByRelationshipName($feature, "usar_hq.rd_81.Site_P_Site_A", [], false);

// Step 2: Get the first related record
// Explanation: We use the First() function to get the first record from the related records.
var related_record = First(relatedRecords);

// Step 3: Check if a related record is found
// Explanation: We check if related_record is null. If it is, we return null to stop further processing.
if (related_record == null) {
    return null;
}

// Debugging: Print the related record
Console("Related record: " + Text(related_record));

// Step 4: Populate fields in the main feature class with fields from the related record
// Explanation: We create an object to return the desired fields from the related record.
return {
    "debug_field": related_record.debug_field
    // Add more fields as needed
    // Uncomment and modify the lines below to include additional fields
    // "accountableorganization": related_record.accountableorganization,
    // "anotherfield": related_record.anotherfield
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and I get this error:&lt;/P&gt;&lt;P&gt;Edit operation failed.&lt;BR /&gt;Message: Unable to complete operation.&lt;BR /&gt;Details: Internal error during object update. Undefined keyword is used in the dictionary return script. [&lt;BR /&gt;Rule name: Site_p2a,&lt;BR /&gt;Triggering event: Update,&lt;BR /&gt;Class name: Site_P,&lt;BR /&gt;GlobalID: {AAF25529-13CD-448C-BDC2-C83DE21711EF}], Undefined keyword is used in the dictionary return script. [debug_field]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;debug_field does exist in the feature class and service.&amp;nbsp; What am I doing wrong?&amp;nbsp; I am sure it is a stupid syntax error on my part.&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;&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>Thu, 24 Oct 2024 15:10:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1551888#M89453</guid>
      <dc:creator>JeffTimm</dc:creator>
      <dc:date>2024-10-24T15:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to create attribute rules in arcade for 2 branch versioned feature classes in a relationship class.</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1551900#M89454</link>
      <description>&lt;PRE&gt;var relatedRecords = FeatureSetByRelationshipName($feature, "usar_hq.rd_81.Site_P_Site_A", ["debug_field"], false);&lt;/PRE&gt;&lt;P&gt;you'll need to add "debug_field" to the list of fields you want to return in relatedRecords.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2024 15:11:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1551900#M89454</guid>
      <dc:creator>ClayDonaldsonSWCA</dc:creator>
      <dc:date>2024-10-24T15:11:06Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to create attribute rules in arcade for 2 branch versioned feature classes in a relationship class.</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1551913#M89456</link>
      <description>&lt;P&gt;With that change I still get the same error. hmm&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2024 15:38:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1551913#M89456</guid>
      <dc:creator>JeffTimm</dc:creator>
      <dc:date>2024-10-24T15:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to create attribute rules in arcade for 2 branch versioned feature classes in a relationship class.</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1552002#M89462</link>
      <description>&lt;P&gt;&lt;A href="https://developers.arcgis.com/arcade/function-reference/featureset_functions/#featuresetbyrelationshipname" target="_self"&gt;FeatureSetByRelationshipName&lt;/A&gt;&amp;nbsp;doesn't use the name of the relationship class object, it uses the name of the relationship as defined by the forward or backward label in that class. You can try using that name or switching to&amp;nbsp;&lt;A href="https://developers.arcgis.com/arcade/function-reference/featureset_functions/#featuresetbyrelationshipclass" target="_self"&gt;FeatureSetByRelationshipClass&lt;/A&gt;&amp;nbsp;if that's supported in your environment.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2024 18:21:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1552002#M89462</guid>
      <dc:creator>DavidSolari</dc:creator>
      <dc:date>2024-10-24T18:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to create attribute rules in arcade for 2 branch versioned feature classes in a relationship class.</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1552006#M89464</link>
      <description>&lt;P&gt;Also, I'm not sure you can return an object like that in rules, you need to return an object with a "result" property which in turn has at least one of "attribute" or "geometry" properties. &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-keywords.htm#ESRI_SECTION1_7FAB1948CDF14FBF9129F8E81463D71E" target="_self"&gt;The docs&lt;/A&gt; have more info on this.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2024 18:26:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1552006#M89464</guid>
      <dc:creator>DavidSolari</dc:creator>
      <dc:date>2024-10-24T18:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to create attribute rules in arcade for 2 branch versioned feature classes in a relationship class.</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1552433#M89510</link>
      <description>&lt;P&gt;yeah I updated my code but still get an error.&lt;/P&gt;&lt;P&gt;Invalid Expression&lt;BR /&gt;No features found&lt;/P&gt;&lt;LI-CODE lang="python"&gt;// Step 1: Get the related records from site_a using the correct relationship class name
var relatedRecords = FeatureSetByRelationshipName($feature, "usar_hq.rd_81.Site_P_Site_A", ["*"], false);

// Step 2: Get the first related record
// Explanation: We use the First() function to get the first record from the related records.
var related_record = First(relatedRecords);

// Step 3: Check if a related record is found
// Explanation: We check if related_record is null. If it is, we return null to stop further processing.
if (related_record == null) {
    return null;
}

// Debugging: Print the related record
Console("Related record: " + Text(related_record));

// Step 4: Populate fields in the main feature class with fields from the related record
// Explanation: We create an object to return the desired fields from the related record.
return {
    //result is a dictionary
    "result": {
        "attributes": {
            "debug_field": related_record.debug_field
            //"accountableorganization": related_record.accountableorganization,
        }
    }
}&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 25 Oct 2024 16:50:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1552433#M89510</guid>
      <dc:creator>JeffTimm</dc:creator>
      <dc:date>2024-10-25T16:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to create attribute rules in arcade for 2 branch versioned feature classes in a relationship class.</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1552466#M89514</link>
      <description>&lt;P&gt;Excellent, that's progress! If your relationship is working, it's possible you don't have any features. You should add a guard by checking if the Count of the relatedRecords is zero and returning early, but if your test data should return a related record then sort out your relationship query before you do that, otherwise you'll bury the true issue. Good luck!&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2024 17:42:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1552466#M89514</guid>
      <dc:creator>DavidSolari</dc:creator>
      <dc:date>2024-10-25T17:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to create attribute rules in arcade for 2 branch versioned feature classes in a relationship class.</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1552488#M89518</link>
      <description>&lt;P&gt;it would be good news if I ran it and got that message but that is in the expression builder.&amp;nbsp; I can't even save it at this point.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;ESRI makes it hard to debug in this interface.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JeffTimm_0-1729880798658.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/118158i170786E7B84BE373/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JeffTimm_0-1729880798658.png" alt="JeffTimm_0-1729880798658.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2024 18:38:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1552488#M89518</guid>
      <dc:creator>JeffTimm</dc:creator>
      <dc:date>2024-10-25T18:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to create attribute rules in arcade for 2 branch versioned feature classes in a relationship class.</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1559267#M90187</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;I finally figured this out. &amp;nbsp;Something so easy I can't believe I overlooked it. &amp;nbsp;I was applying the attribute rule to that parent feature class in the relationship class. &amp;nbsp;This is incorrect. &amp;nbsp;The attribute rule should be applied to the child feature class. &amp;nbsp;The one where the edits are applied to once the parent feature class is triggered with an update.&amp;nbsp; I was also able to simplify the code.&amp;nbsp; I was making to complex trying to get it to work.&amp;nbsp; Below is the code that ended up doing the trick.&amp;nbsp; I did notice a delay in the updates to the child feature class.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;// calculation attribute rule on child
// field: if you want to get only one field from the parent, then chose 
// that field. if you want to get multiple fields, leave empty
// triggers: Insert(, update)

// load the related parent features using
// a relationship class between parent and child:
var parent_fs = FeatureSetByRelationshipName($feature, "db.schema.AttributeRuleName")

// return nothing if no parent feature was found
var parent = First(parent_fs)
if(parent == null) { return }

// if you want to return multiple fields:
var att = {
  "accountableorganization": parent.accountableorganization,
  "coordinatex": parent.coordinatex,
  "coordinatey": parent.coordinatey
}
return {"result": {"attributes": att}}&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 15 Nov 2024 17:37:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1559267#M90187</guid>
      <dc:creator>JeffTimm</dc:creator>
      <dc:date>2024-11-15T17:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to create attribute rules in arcade for 2 branch versioned feature classes in a relationship class.</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1559269#M90188</link>
      <description>&lt;P&gt;nice - attribute rule are such a pain to debug! I hope ESRI improves the console output/logging.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 17:40:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/i-am-trying-to-create-attribute-rules-in-arcade/m-p/1559269#M90188</guid>
      <dc:creator>ClayDonaldsonSWCA</dc:creator>
      <dc:date>2024-11-15T17:40:42Z</dc:date>
    </item>
  </channel>
</rss>

