<?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: Populate a value from one table to another using a joining field in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/populate-a-value-from-one-table-to-another-using-a/m-p/1171846#M410</link>
    <description>&lt;P&gt;Ah OK, in that case, you're editing the $feature itself, which makes it a little easier:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// calculation attribute rule
// triggers: insert(, update)
// field: GdBOrderNumber

var f_gid = $feature.LocationGlobalID;
var related_records = FeatureSetByName($datastore, "Database.DBO.[FeatureClass]", ["*"], false);
var Join = Filter(related_records, "GlobalID = @f_gid");

// return GdBOrderNumber of the first feature in Join
// if Join is empty (no related features found), return null
var firstJoin = First(Join)
if(firstJoin == null) {
    return null
}
return firstJoin.GdBOrderNumber

// or, if you leave the field parameter empty:
return {
    "result": {"attributes": {"GdBOrderNumber": firstJoin.GdBOrderNumber}}
}&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 09 May 2022 05:41:11 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2022-05-09T05:41:11Z</dc:date>
    <item>
      <title>Populate a value from one table to another using a joining field</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/populate-a-value-from-one-table-to-another-using-a/m-p/1170095#M402</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to populate a field based on where a joining ID is between two tables. I have a relationship class set up between two tables but I want to bring over another value than just a GlobalID. So I was trying to use an attribute class to do this but it is not working for me. Can someone help?&lt;/P&gt;&lt;P&gt;My joining field is LocationGlobalID = GlobalID&lt;/P&gt;&lt;P&gt;The field I want populated from one table to the other is GdBOrderNumber =&amp;nbsp;GdBOrderNumber&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var f_gid = $feature.LocationGlobalID;&lt;BR /&gt;&lt;BR /&gt;var Project = FeatureSetByName($datastore, "Database.DBO.[Other Table]", ["*"], true);&lt;BR /&gt;var Join = Filter(Project, "GlobalID = @f_gid");&lt;BR /&gt;&lt;BR /&gt;return {&lt;BR /&gt;'result': $feature.GdBOrderNumber,&lt;BR /&gt;'edit': [&lt;BR /&gt;{"GdBOrderNumber": $feature.GdBOrderNumber&lt;BR /&gt;} &lt;BR /&gt;]&lt;BR /&gt;};&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 13:40:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/populate-a-value-from-one-table-to-another-using-a/m-p/1170095#M402</guid>
      <dc:creator>GdB_Admin</dc:creator>
      <dc:date>2022-05-03T13:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a value from one table to another using a joining field</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/populate-a-value-from-one-table-to-another-using-a/m-p/1170110#M403</link>
      <description>&lt;P&gt;So, you have Table A with this rule and you want to populate the field "GdBOrderNumber" on Table B, is that correct?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// calculation attribute rule
// triggers: insert(, update)
// field: empty

// get the related record(s)
// either use FeatureSetByName() and Filter() like you did
// or use the relationship class:
var related_records = FeatureSetByRelationshipName($feature, "RelationShipName", ["GlobalID"], false)
// we're only interested in the related records' GlobalID, because we need that to identify them in the return dictionary

// create and fill the update array
var updates = []
for(var record in related_records) {
    // updates is an array of dictionaries
    // the dictionaries are built like this:
    // {"globalID": "GID of the edited feature", "attributes": {"Field": value}}
    var update = {"globalID": record.GlobalID, "attributes": {"GdBOrderNumber": $feature.GdBOrderNumber}}
    Push(updates, update)
}

// apply the edits
return {
    "edit": [
        {
            "className": "Database.DBO.OtherTable",
            "updates": updates
        }
    ]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To learn more about the return dictionary keywords, read this:&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;Attribute rule dictionary keywords—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 14:06:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/populate-a-value-from-one-table-to-another-using-a/m-p/1170110#M403</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-05-03T14:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a value from one table to another using a joining field</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/populate-a-value-from-one-table-to-another-using-a/m-p/1170175#M404</link>
      <description>&lt;P&gt;That is what i was looking for and thank you for the link that will help a lot&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 15:24:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/populate-a-value-from-one-table-to-another-using-a/m-p/1170175#M404</guid>
      <dc:creator>GdB_Admin</dc:creator>
      <dc:date>2022-05-03T15:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a value from one table to another using a joining field</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/populate-a-value-from-one-table-to-another-using-a/m-p/1171210#M409</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;I spoke a bit too early on this. what you gave&amp;nbsp; me works but it is in the wrong direction form what I am looking for. the set up is the FeatureClass has the relationship class on it. When an inspection is done it is being put into the table using that GlobalID = LocationGlobalID. From here now that the Table has a new record in it I need to use that Relationship Class ID (LocationGlobalID) and grab the&amp;nbsp;&lt;SPAN&gt;GdBOrderNumber field from the FeatureClass and apply it to the Table. I am putting the Attribute Rule on the Table because that is where the Insert is taking place. I tried to change the code you gave me but it keeps giving me errors or just does nothing. I tried to use the LocationGlobalID field in the dictionary like you said but it is telling me I need to use the GlobalID field, but when I do that it does not do anything. Here is what I have:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;var f_gid = $feature.LocationGlobalID;&lt;BR /&gt;var related_records = FeatureSetByName($datastore, "Database.DBO.[FeatureClass]", ["*"], false);&lt;BR /&gt;var Join = Filter(related_records, "GlobalID = @f_gid");&lt;BR /&gt;&lt;BR /&gt;// create and fill the update array&lt;BR /&gt;var updates = []&lt;BR /&gt;for(var record in Join) {&lt;BR /&gt;// updates is an array of dictionaries&lt;BR /&gt;// the dictionaries are built like this:&lt;BR /&gt;// {"globalID": "GID of the edited feature", "attributes": {"Field": value}}&lt;BR /&gt;var update = {"LocationGlobalID": record.GlobalID, "attributes": {"GdBOrderNumber": record.GdBOrderNumber}}&lt;BR /&gt;Push(updates, update)&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;// apply the edits&lt;BR /&gt;return {&lt;BR /&gt;"edit": [&lt;BR /&gt;{&lt;BR /&gt;"className": "Database.DBO.[Table]",&lt;BR /&gt;"updates": updates&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 17:54:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/populate-a-value-from-one-table-to-another-using-a/m-p/1171210#M409</guid>
      <dc:creator>GdB_Admin</dc:creator>
      <dc:date>2022-05-05T17:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a value from one table to another using a joining field</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/populate-a-value-from-one-table-to-another-using-a/m-p/1171846#M410</link>
      <description>&lt;P&gt;Ah OK, in that case, you're editing the $feature itself, which makes it a little easier:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// calculation attribute rule
// triggers: insert(, update)
// field: GdBOrderNumber

var f_gid = $feature.LocationGlobalID;
var related_records = FeatureSetByName($datastore, "Database.DBO.[FeatureClass]", ["*"], false);
var Join = Filter(related_records, "GlobalID = @f_gid");

// return GdBOrderNumber of the first feature in Join
// if Join is empty (no related features found), return null
var firstJoin = First(Join)
if(firstJoin == null) {
    return null
}
return firstJoin.GdBOrderNumber

// or, if you leave the field parameter empty:
return {
    "result": {"attributes": {"GdBOrderNumber": firstJoin.GdBOrderNumber}}
}&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 09 May 2022 05:41:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/populate-a-value-from-one-table-to-another-using-a/m-p/1171846#M410</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-05-09T05:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: Populate a value from one table to another using a joining field</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/populate-a-value-from-one-table-to-another-using-a/m-p/1172419#M414</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;that is what i was looking for thank you for your help&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 14:15:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/populate-a-value-from-one-table-to-another-using-a/m-p/1172419#M414</guid>
      <dc:creator>GdB_Admin</dc:creator>
      <dc:date>2022-05-10T14:15:01Z</dc:date>
    </item>
  </channel>
</rss>

