<?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: Adding features to related tables in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/adding-features-to-related-tables/m-p/1335344#M73726</link>
    <description>&lt;P&gt;You can use &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/an-overview-of-attribute-rules.htm" target="_blank"&gt;an attribute rule&lt;/A&gt; for this, have it execute when features are added or edited in the feature class. There are lots of examples in this repo, too: &lt;A href="https://github.com/Esri/arcade-expressions/tree/master/attribute_rule_calculation" target="_blank"&gt;https://github.com/Esri/arcade-expressions/tree/master/attribute_rule_calculation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It would look something like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var org = $feature.org_name

var org_fs = FeatureSetByRelationshipName(
  $feature,
  'organizations_features_relationship_name',
  ['guid_field', 'org_name'],
  false
)

matching_org = First(org_fs)

return matching_org['guid_field']&lt;/LI-CODE&gt;&lt;P&gt;A further refinement would be to check if the original feature and the edited feature have the same value for the 'org_name' field. If that field isn't changing, there's no reason to execute the rest of the expression.&lt;/P&gt;&lt;P&gt;Also, if you anticipate making edits on the organization table, you can use an attribute rule that will take any edits to the table and pass them down to all related features as well.&lt;/P&gt;</description>
    <pubDate>Thu, 05 Oct 2023 13:17:36 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2023-10-05T13:17:36Z</dc:date>
    <item>
      <title>Adding features to related tables</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-features-to-related-tables/m-p/1335308#M73717</link>
      <description>&lt;P&gt;I have a table that contains organization names and a feature class that contains features that belong to the organizations. This is a 1-M relationship, organizations can be related to many features, but the features only relate to one organization. The primary key would be the organization's name. The table contains a GUID for each organization.&lt;/P&gt;&lt;P&gt;I would like the relationship class set up so that when I add a new feature, and enter the organizations name, the org's GUID populates another field in the feature class. Is there a way to set up the relationship class so that this happens automatically? It seems similar to a composite relationship. I don't have a solid understanding of how related tables work, so I'm not sure if this is possible, or if I need to take another approach.&lt;SPAN&gt;&amp;nbsp;I think the other way to accomplish my goal would be to use an arcade expression in a calculation attribute rule to look up the organizations GUID in the table and then write it to the feature class field.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;All data is stored in an enterprise geodatabase&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 10:25:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-features-to-related-tables/m-p/1335308#M73717</guid>
      <dc:creator>JamesTurner2</dc:creator>
      <dc:date>2023-10-05T10:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: Adding features to related tables</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-features-to-related-tables/m-p/1335344#M73726</link>
      <description>&lt;P&gt;You can use &lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/an-overview-of-attribute-rules.htm" target="_blank"&gt;an attribute rule&lt;/A&gt; for this, have it execute when features are added or edited in the feature class. There are lots of examples in this repo, too: &lt;A href="https://github.com/Esri/arcade-expressions/tree/master/attribute_rule_calculation" target="_blank"&gt;https://github.com/Esri/arcade-expressions/tree/master/attribute_rule_calculation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;It would look something like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var org = $feature.org_name

var org_fs = FeatureSetByRelationshipName(
  $feature,
  'organizations_features_relationship_name',
  ['guid_field', 'org_name'],
  false
)

matching_org = First(org_fs)

return matching_org['guid_field']&lt;/LI-CODE&gt;&lt;P&gt;A further refinement would be to check if the original feature and the edited feature have the same value for the 'org_name' field. If that field isn't changing, there's no reason to execute the rest of the expression.&lt;/P&gt;&lt;P&gt;Also, if you anticipate making edits on the organization table, you can use an attribute rule that will take any edits to the table and pass them down to all related features as well.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 13:17:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-features-to-related-tables/m-p/1335344#M73726</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2023-10-05T13:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: Adding features to related tables</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-features-to-related-tables/m-p/1335392#M73730</link>
      <description>&lt;P&gt;Just what I needed, thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;!&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 14:49:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-features-to-related-tables/m-p/1335392#M73730</guid>
      <dc:creator>JamesTurner2</dc:creator>
      <dc:date>2023-10-05T14:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: Adding features to related tables</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-features-to-related-tables/m-p/1336913#M73905</link>
      <description>&lt;P data-unlink="true"&gt;I've got this working, if I wanted to implement the refinement you suggest, does that require another related table as laid out in the &lt;A href="https://github.com/Esri/arcade-expressions/blob/master/attribute_rule_calculation/LastValue.js" target="_self"&gt;LastValue&lt;/A&gt; script? Or is there a simpler way to execute this?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2023 13:47:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-features-to-related-tables/m-p/1336913#M73905</guid>
      <dc:creator>JamesTurner2</dc:creator>
      <dc:date>2023-10-11T13:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: Adding features to related tables</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-features-to-related-tables/m-p/1336915#M73906</link>
      <description>&lt;P&gt;No, you just have to reference the &lt;STRONG&gt;originalFeature&lt;/STRONG&gt; object.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var orig_name = $originalFeature.org_name
var org = $feature.org_name

// see if value has changed
if (org == orig_name) {
  // no change, return original value
  return orig_name
} else {
  // change! get GUID from other table
  var org_fs = FeatureSetByRelationshipName(
    $feature,
    'organizations_features_relationship_name',
    ['guid_field', 'org_name'],
    false
  )

  matching_org = First(org_fs)

  return matching_org['guid_field']
}&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 11 Oct 2023 13:59:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-features-to-related-tables/m-p/1336915#M73906</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2023-10-11T13:59:41Z</dc:date>
    </item>
  </channel>
</rss>

