<?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 to Populate Child Field Based on Parent Field Contingency in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-populate-child-field-based-on/m-p/1651468#M1891</link>
    <description>&lt;P&gt;That worked!&amp;nbsp; One of the parent fields contained empty - not null - values so once I edited the attribution to "&amp;lt;null", that code functioned correctly.&lt;/P&gt;&lt;P&gt;Conversely, on the parent feature class, I have a rule set up which would update the child field if the parent field attribute changed.&amp;nbsp; This works fine when it's one field in the parent to one field in the child.&amp;nbsp; The code is below.&lt;/P&gt;&lt;P&gt;However, now I'd like it to say...if Parent Field 1 changes, update Child Field &lt;EM&gt;or&lt;/EM&gt; if Parent Field 2 changes, update (same) Child Field.&amp;nbsp; This would allow the child field to update based on whichever of the two parent fields gets update (could ostensibly go back and forth).&amp;nbsp; I am not sure how I would set this up.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;if ($originalfeature.PARENT FIELD 2 == $feature.PARENT FIELD 2) {
    return
}

var fs = FeatureSetByRelationshipName($feature, "RELATIONSHIP CLASS NAME");

var updates = []
for(var f in fs) {
    if(f.GlobalID == $feature.GlobalID) { continue }
    if(f.CHILD FIELD == $feature.PARENT FIELD 2) continue;
    var u  = {
        globalID: f.GlobalID,
        attributes: {
            "CHILD FIELD": $feature.PARENT FIELD 2
            }
        }
    Push(updates, u)
}

return {
    edit: [{
        className: "RELATED DATASET NAME",
        updates: updates
        }]
}&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 18 Sep 2025 14:28:49 GMT</pubDate>
    <dc:creator>ChristopherBowering</dc:creator>
    <dc:date>2025-09-18T14:28:49Z</dc:date>
    <item>
      <title>Attribute Rule to Populate Child Field Based on Parent Field Contingency</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-populate-child-field-based-on/m-p/1651270#M1886</link>
      <description>&lt;P&gt;I have a point feature class (parent) and a related table (child) in an Enterprise Geodatabase (v 11.4).&amp;nbsp; They have a user-defined relationship class.&amp;nbsp; Upon child record creation, I would like a field in the child table to populate based on 1 of 2 parent fields using conditionality.&amp;nbsp; If Parent Field 1 contains a value, child field will populate from Parent Field 1.&amp;nbsp; If Parent Field 1 is empty, the child field will populate from Parent Field 2.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The attribute rule below is set to the child field to-be-populated.&amp;nbsp; It passes validation and is able to be saved as an attribute rule.&amp;nbsp; However, upon attempting to add a record to the child table, an error says "invalid column value [parent field 1 field name]".&lt;/P&gt;&lt;P&gt;If anyone can tweak this or provide a better code to accomplish my goal, I'd appreciate it!&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// Define the relationship name between the child and parent feature classes/tables
var Relationship = "RELATIONSHIP CLASS NAME"; // Replace with your actual relationship name

// Get the related parent feature(s)
var RelatedParentFeatures = FeatureSetByRelationshipName($feature, Relationship);

// Get the first related parent feature (assuming a one-to-one or one-to-many relationship where you want the first related parent)
var ParentFeature = First(RelatedParentFeatures);

// Check if a parent feature exists and if the specific parent field is empty
if (IsEmpty(ParentFeature) || IsEmpty(ParentFeature.PARENT FIELD 1)) {
    // If the parent feature or the parent field is empty, populate the child field with a default value or null
    return "PARENT FIELD 2"
} else {
    // If the parent field has a value, populate the child field with the parent's field value
    return ParentFeature.PARENT FIELD 1;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Sep 2025 21:17:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-populate-child-field-based-on/m-p/1651270#M1886</guid>
      <dc:creator>ChristopherBowering</dc:creator>
      <dc:date>2025-09-17T21:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule to Populate Child Field Based on Parent Field Contingency</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-populate-child-field-based-on/m-p/1651273#M1887</link>
      <description>&lt;P&gt;Need to pass in the list of fields to FeatureSetByRelationship&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/arcade/function-reference/featureset_functions/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/arcade/function-reference/featureset_functions/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;also&amp;nbsp;PARENT FIELD 1 cannot be a valid field name&lt;/P&gt;</description>
      <pubDate>Wed, 17 Sep 2025 21:24:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-populate-child-field-based-on/m-p/1651273#M1887</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2025-09-17T21:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule to Populate Child Field Based on Parent Field Contingency</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-populate-child-field-based-on/m-p/1651275#M1888</link>
      <description>&lt;P&gt;Hi Mike.&amp;nbsp; Those "Parent..." field names are not actual field names.&amp;nbsp; Nor is "RELATIONSHIP CLASS NAME" the name of my actual relationship class.&amp;nbsp; They are just placeholders that correspond to my written description to make it easier for a reader to reference.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Doesn't the FeatureSetByRelationshipName supersede the FeatureSetByRelationship function?&amp;nbsp; I didn't think a list of fields were necessary if the relationship and specific fields involved were individually called out.&amp;nbsp; Could you indicate how that function would be used in my example?&amp;nbsp; Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 17 Sep 2025 21:35:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-populate-child-field-based-on/m-p/1651275#M1888</guid>
      <dc:creator>ChristopherBowering</dc:creator>
      <dc:date>2025-09-17T21:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule to Populate Child Field Based on Parent Field Contingency</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-populate-child-field-based-on/m-p/1651277#M1889</link>
      <description>&lt;P&gt;I do not think FeatureSetByRelationshipName exist&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Must use a string literal, do not use a variable
var relatedFS = FeatureSetByRelationshipClass($feature, "RELATIONSHIP CLASS NAME", ["field1","field2"], false);

var ParentFeature = First(relatedFS);
if (ParentFeature == null){
  return
}
if (ParentFeature.field1 == null){
  return ParentFeature.field2; 
}
return ParentFeature.field1&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 17 Sep 2025 21:38:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-populate-child-field-based-on/m-p/1651277#M1889</guid>
      <dc:creator>MikeMillerGIS</dc:creator>
      <dc:date>2025-09-17T21:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule to Populate Child Field Based on Parent Field Contingency</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-populate-child-field-based-on/m-p/1651417#M1890</link>
      <description>&lt;P&gt;FeatureSetByRelationshipName (&lt;A href="https://developers.arcgis.com/arcade/function-reference/featureset_functions/#featuresetbyrelationshipname:~:text=Count(fsinspected)%3B-,FeatureSetByRelationshipName,-FeatureSetByRelationshipName(inputFeature%2C%20relationshipName)" target="_blank"&gt;https://developers.arcgis.com/arcade/function-reference/featureset_functions/#featuresetbyrelationshipname:~:text=Count(fsinspected)%3B-,FeatureSetByRelationshipName,-FeatureSetByRelationshipName(inputFeature%2C%20relationshipName)&lt;/A&gt;&amp;nbsp;is a function I use often when transferring attributes between related datasets.&amp;nbsp; I've just never tried it with an IF statement so I know I'm missing something.&lt;/P&gt;&lt;P&gt;Maybe the ByRelationshipClass function will be better in this situation!&amp;nbsp; I will give it a go.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Sep 2025 12:49:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-populate-child-field-based-on/m-p/1651417#M1890</guid>
      <dc:creator>ChristopherBowering</dc:creator>
      <dc:date>2025-09-18T12:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule to Populate Child Field Based on Parent Field Contingency</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-populate-child-field-based-on/m-p/1651468#M1891</link>
      <description>&lt;P&gt;That worked!&amp;nbsp; One of the parent fields contained empty - not null - values so once I edited the attribution to "&amp;lt;null", that code functioned correctly.&lt;/P&gt;&lt;P&gt;Conversely, on the parent feature class, I have a rule set up which would update the child field if the parent field attribute changed.&amp;nbsp; This works fine when it's one field in the parent to one field in the child.&amp;nbsp; The code is below.&lt;/P&gt;&lt;P&gt;However, now I'd like it to say...if Parent Field 1 changes, update Child Field &lt;EM&gt;or&lt;/EM&gt; if Parent Field 2 changes, update (same) Child Field.&amp;nbsp; This would allow the child field to update based on whichever of the two parent fields gets update (could ostensibly go back and forth).&amp;nbsp; I am not sure how I would set this up.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;if ($originalfeature.PARENT FIELD 2 == $feature.PARENT FIELD 2) {
    return
}

var fs = FeatureSetByRelationshipName($feature, "RELATIONSHIP CLASS NAME");

var updates = []
for(var f in fs) {
    if(f.GlobalID == $feature.GlobalID) { continue }
    if(f.CHILD FIELD == $feature.PARENT FIELD 2) continue;
    var u  = {
        globalID: f.GlobalID,
        attributes: {
            "CHILD FIELD": $feature.PARENT FIELD 2
            }
        }
    Push(updates, u)
}

return {
    edit: [{
        className: "RELATED DATASET NAME",
        updates: updates
        }]
}&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 18 Sep 2025 14:28:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-populate-child-field-based-on/m-p/1651468#M1891</guid>
      <dc:creator>ChristopherBowering</dc:creator>
      <dc:date>2025-09-18T14:28:49Z</dc:date>
    </item>
  </channel>
</rss>

