<?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 transfer a value from a parent feature class to a related child table field in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-transfer-a-value-from-a-parent/m-p/1327887#M72970</link>
    <description>&lt;P&gt;Hi Johannes!&amp;nbsp; Thank you for taking the time to respond to my question, I greatly appreciate it! Based on your suggestions, I selected the StructureType field from the StructureInspection table in the Field box for the Attribute Rule. This is where I want the output of the expression to be stored (the value of the StructureType field). I added your code in the expression box.&amp;nbsp; Added the trigger update so now have Insert and Update triggers. I checked exclude from application evaluation. I saved it. The attribute rule turned green. I published my layer. Created a web map with forms in ArcGIS Online.&amp;nbsp; Opened my webmap in Field Map App. I created a structure feature and then created a new record in the structure inspection table and the StructureType will not autopopulate with the StructureType from the parent feature class.&amp;nbsp; Someone suggested I uncheck the Exclude from application evaluation, so I went back into my ArcGIS Pro Project and unchecked the Exclude from application evaluation, and now when trying to create a new Attribute Rule, after saving it turns gray instead of green.&amp;nbsp; I deleted the attribute rule and created a new one and I am still getting a gray box instead of green after saving.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Sep 2023 18:38:00 GMT</pubDate>
    <dc:creator>ChristineTombleson1</dc:creator>
    <dc:date>2023-09-12T18:38:00Z</dc:date>
    <item>
      <title>Attribute Rule to transfer a value from a parent feature class to a related child table field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-transfer-a-value-from-a-parent/m-p/1326864#M72867</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;I have a Parent Feature Class in ArcGIS Pro called "Structure" that has a field called StructureType that has subtypes of Rock Sill, Coir Log, Oyster Structure, etc. &amp;nbsp;I have a related child table called "StructureInspection" to collect inspection data on these structures. One structure will have many inspections. &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristineTombleson1_2-1694192039682.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/80214iDD775AECC99A5FC5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristineTombleson1_2-1694192039682.png" alt="ChristineTombleson1_2-1694192039682.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristineTombleson1_3-1694192136656.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/80215i0D807C7B26BE431B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristineTombleson1_3-1694192136656.png" alt="ChristineTombleson1_3-1694192136656.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The feature class and the StructureInspection table are related by GlobalID and GUID fields.&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;The StructureInspection table holds all inspection fields for all Structure types.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;Each StructureType has different inspection fields associated with it.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;I need the StructureType field in the StructureInspection table populated with the value of the StructureType of the Parent feature class to be able to control what fields are visible on the inspection form in Field Maps for the specific structuretype.&lt;/SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;I don't want users to have to enter in the structure type every time for a structure inspection. &amp;nbsp;The StructureType is designated with the feature when it is created, and the structure inspection table is related to the feature (through a relationship class called Structure_StructureInspection).&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The datatype of the StructureType field in the parent feature class is Short (Numeric) because it has subtypes.&lt;/DIV&gt;&lt;DIV&gt;The datatype of the StructureType field in the StructureInspection table is Short to be compatible.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I want the StructureType value of the parent feature class to automatically populate in the StructureType field of the related child StructureInspection table when a new record is created in the StructureInspection table.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have tried doing this using an Attribute Rule in ArcGIS Pro: &amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;      Using the Calculation Rule&lt;/DIV&gt;&lt;DIV&gt;      I did not select a field; I want this to trigger with any field.&lt;/DIV&gt;&lt;DIV&gt;      I have it triggering on Insert, when a record is created&lt;/DIV&gt;&lt;DIV&gt;The Arcade expression used:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;var relTable = "StructureInspection"&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;var GUID = $feature.StrucInsp_GUID&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;var Structure = FeatureSetByName($datastore, "Structure", ["GlobalID", "StructureType"], false);&lt;/DIV&gt;&lt;DIV&gt;var related_inspections = Filter(Structure, "GlobalID = @GUID");&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;var structureTypes = [];&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;for (var i in related_inspections) {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; structureTypes[i] = related_inspections[i]["StructureType"];&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;return structureTypes;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I get no errors with the Attribute Rule, but the StructureType does not populate when a new record is created in the StructureInspection table.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;SPAN&gt;I would love if someone could help solve why this is not working! &amp;nbsp;Thank you!!! &amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristineTombleson1_4-1694192219439.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/80216i1745F0A93C1AE1EF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristineTombleson1_4-1694192219439.png" alt="ChristineTombleson1_4-1694192219439.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 08 Sep 2023 16:58:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-transfer-a-value-from-a-parent/m-p/1326864#M72867</guid>
      <dc:creator>ChristineTombleson1</dc:creator>
      <dc:date>2023-09-08T16:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule to transfer a value from a parent feature class to a related child table field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-transfer-a-value-from-a-parent/m-p/1327180#M72913</link>
      <description>&lt;UL&gt;&lt;LI&gt;you actually do want to assign this rule to a field. The field parameter controls in which field the output of the expression is stored. An edit to any field will trigger the rule.&lt;/LI&gt;&lt;LI&gt;your variable names are very misleading. related_inspections is actually the Structure feature class!&lt;/LI&gt;&lt;LI&gt;if you have a relationship class, you can use FeaturesetByRelationshipName() instead of filtering the Featureset yourself&lt;/LI&gt;&lt;LI&gt;your for loop treats the Featureset like an array. For arrays, the loop counter (i) is an integer. For Featuresets, it is the current feature. So your indexing doesn't work, because i is a Feature, not a number.&lt;/LI&gt;&lt;LI&gt;You're trying to return an Array, but the rule expects a single value.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something like this should work:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Calculation Attribute Rule on hte inspection table
// field: StructureType
// triggers: Insert, Update
    // depending on how you create your inspection record, it won't be able to find the parent feature on Insert, so you should also trigger on Update


// optional: abort if there is already a value in the field
if(!IsEmpty($feature.StructureType)) { return $feature.StructureType }

// get the parent feature
var parent = First(FeaturesetByRelationshipName($feature, "Structure_StructureInspection"))

// if a parent feature was found, return its StructureType, else return a default value
return IIf(parent == null, "no parent found", parent.StructureType)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 11 Sep 2023 09:19:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-transfer-a-value-from-a-parent/m-p/1327180#M72913</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-09-11T09:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute Rule to transfer a value from a parent feature class to a related child table field</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-transfer-a-value-from-a-parent/m-p/1327887#M72970</link>
      <description>&lt;P&gt;Hi Johannes!&amp;nbsp; Thank you for taking the time to respond to my question, I greatly appreciate it! Based on your suggestions, I selected the StructureType field from the StructureInspection table in the Field box for the Attribute Rule. This is where I want the output of the expression to be stored (the value of the StructureType field). I added your code in the expression box.&amp;nbsp; Added the trigger update so now have Insert and Update triggers. I checked exclude from application evaluation. I saved it. The attribute rule turned green. I published my layer. Created a web map with forms in ArcGIS Online.&amp;nbsp; Opened my webmap in Field Map App. I created a structure feature and then created a new record in the structure inspection table and the StructureType will not autopopulate with the StructureType from the parent feature class.&amp;nbsp; Someone suggested I uncheck the Exclude from application evaluation, so I went back into my ArcGIS Pro Project and unchecked the Exclude from application evaluation, and now when trying to create a new Attribute Rule, after saving it turns gray instead of green.&amp;nbsp; I deleted the attribute rule and created a new one and I am still getting a gray box instead of green after saving.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 18:38:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-rule-to-transfer-a-value-from-a-parent/m-p/1327887#M72970</guid>
      <dc:creator>ChristineTombleson1</dc:creator>
      <dc:date>2023-09-12T18:38:00Z</dc:date>
    </item>
  </channel>
</rss>

