<?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 actively transfer data from a related table to it’s parent feature class and vice versa in Attribute Rules Questions</title>
    <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141506#M312</link>
    <description>&lt;P&gt;It is possible. But you dont define the rule on the feature class, you do it on the work history table.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Attribute Rule on the work history table
// Triggers: Update
// Field: empty

// do nothing if meter id did not change (so you don't send senseless update requests)
if($originalfeature.MeterID == $feature.MeterID) { return null }

// get the water meter
var water_meter = First(FeatureSetByRelationshipName($feature, "RelationshipName"))
if(water_meter == null) { return null }

// Send a request to update the MeterID in the parent FC
return {
  "edit": [
    {
      "className": "WaterMeterFC",
      "updates": [
        {"globalID": water_meter.GlobalID, "attributes": {"MeterID": $feature.MeterID}}
      ]
    }
  ]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Feb 2022 08:59:57 GMT</pubDate>
    <dc:creator>JohannesLindner</dc:creator>
    <dc:date>2022-02-08T08:59:57Z</dc:date>
    <item>
      <title>Attribute rule to actively transfer data from a related table to it’s parent feature class and vice versa</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141445#M310</link>
      <description>&lt;P&gt;Using ArcGIS Enterprise 10.9.1 - Field Maps version 21.4.0. I am curious if we are able to create an attribute rule to transfer a value from a related table to the parent feature class upon record submission?&lt;/P&gt;&lt;P&gt;I currently have attribute rules in place that transfers a water meter’s brand, meter ID, and latest reading from the parent feature class to the related work history table when the record is created. This is successful. I would like to then use another attribute rule on the feature class to automatically update the new meter ID once the new value is typed into the related work history table.&lt;/P&gt;&lt;P&gt;Is this type of workflow supported - actively transferring data from the parent feature to its related table and vice versa? If so, is the attribute rule created in the same manner? Unfortunately I’m not having successful results returning values from the related table back to the parent feature class.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 00:35:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141445#M310</guid>
      <dc:creator>Terry_Bearb</dc:creator>
      <dc:date>2022-02-08T00:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to actively transfer data from a related table to it’s parent feature class and vice versa</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141447#M311</link>
      <description>&lt;P&gt;That should be possible, you need to add an attribute rule to the related table. One thing to watch for is cyclic execution and infinite loops. (Parent updates child, child turns out updates parent, which turns out and update child and that goes on.) We detect and protect against such cases but you will need to write the rules such that it has a base condition to quit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 00:42:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141447#M311</guid>
      <dc:creator>HusseinNasser2</dc:creator>
      <dc:date>2022-02-08T00:42:24Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to actively transfer data from a related table to it’s parent feature class and vice versa</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141506#M312</link>
      <description>&lt;P&gt;It is possible. But you dont define the rule on the feature class, you do it on the work history table.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Attribute Rule on the work history table
// Triggers: Update
// Field: empty

// do nothing if meter id did not change (so you don't send senseless update requests)
if($originalfeature.MeterID == $feature.MeterID) { return null }

// get the water meter
var water_meter = First(FeatureSetByRelationshipName($feature, "RelationshipName"))
if(water_meter == null) { return null }

// Send a request to update the MeterID in the parent FC
return {
  "edit": [
    {
      "className": "WaterMeterFC",
      "updates": [
        {"globalID": water_meter.GlobalID, "attributes": {"MeterID": $feature.MeterID}}
      ]
    }
  ]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 08:59:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141506#M312</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-02-08T08:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to actively transfer data from a related table to it’s parent feature class and vice versa</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141565#M313</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/346994"&gt;@HusseinNasser2&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;for the replies. I think my main issue comes from me placing the attribute rule on the parent feature class rather than the related work history table and there seemed to be some looping occurring. Can you guys please let me know if this is what I should be inputting as an attribute rule?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where &lt;STRONG&gt;Old_MeterId&lt;/STRONG&gt; is the field on the work history table that stores the original Meter ID from the feature class, &lt;STRONG&gt;New_MeterId&lt;/STRONG&gt; is the field on the work history table that is used for input of the new Meter ID after it has been replaced,&amp;nbsp;&lt;STRONG&gt;test.DBO.WaterMeterTOWorkHistory_TEST&lt;/STRONG&gt; is the name of the relationship class being used,&amp;nbsp;&lt;STRONG&gt;test.DBO.WaterMeterTEST&lt;/STRONG&gt; is the name of the parent feature class, and&amp;nbsp;&lt;STRONG&gt;Meter_ID&lt;/STRONG&gt; is the Meter ID field on the parent feature class that is to be updated if a new Meter ID was inputted into the work history table.&lt;/P&gt;&lt;P&gt;// Attribute Rule on the work history table&lt;BR /&gt;// Triggers: Update&lt;BR /&gt;// Field: empty&lt;/P&gt;&lt;P&gt;// do nothing if meter id did not change (so you don't send senseless update requests)&lt;BR /&gt;if($originalfeature.&lt;STRONG&gt;Old_MeterId&lt;/STRONG&gt; == $feature.&lt;STRONG&gt;New_MeterId&lt;/STRONG&gt;) { return null }&lt;/P&gt;&lt;P&gt;// get the water meter&lt;BR /&gt;var water_meter = First(FeatureSetByRelationshipName($feature, "&lt;STRONG&gt;test.DBO.WaterMeterTOWorkHistory_TEST&lt;/STRONG&gt;"))&lt;BR /&gt;if(water_meter == null) { return null }&lt;/P&gt;&lt;P&gt;// Send a request to update the MeterID in the parent FC&lt;BR /&gt;return {&lt;BR /&gt;"edit": [&lt;BR /&gt;{&lt;BR /&gt;"className": "&lt;STRONG&gt;test.DBO.WaterMeterTEST&lt;/STRONG&gt;",&lt;BR /&gt;"updates": [&lt;BR /&gt;{"globalID": water_meter.GlobalID, "attributes": {"MeterID": $feature.&lt;STRONG&gt;Meter_ID&lt;/STRONG&gt;}}&lt;BR /&gt;]&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 13:56:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141565#M313</guid>
      <dc:creator>Terry_Bearb</dc:creator>
      <dc:date>2022-02-08T13:56:44Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to actively transfer data from a related table to it’s parent feature class and vice versa</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141568#M314</link>
      <description>&lt;P&gt;What's your workflow here? Do you insert the work history record with Old_MeterID and New_MeterID or do you change New_MeterID after the record is already inserted?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 14:02:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141568#M314</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-02-08T14:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to actively transfer data from a related table to it’s parent feature class and vice versa</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141572#M315</link>
      <description>&lt;P&gt;Both of the values are inserted at the same time. User input on the New_MeterId field in the work history table and a triggered insert/update immediate attribute rule on the Old_MeterId field to populate the value from the parent FC.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 14:07:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141572#M315</guid>
      <dc:creator>Terry_Bearb</dc:creator>
      <dc:date>2022-02-08T14:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to actively transfer data from a related table to it’s parent feature class and vice versa</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141583#M316</link>
      <description>&lt;P&gt;OK, then the rule should trigger on Insert.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Attribute Rule on the work history table
// Triggers: Insert
// Field: empty


// get the water meter
var water_meter = First(FeatureSetByRelationshipName($feature, "test.DBO.WaterMeterTOWorkHistory_TEST"))
if(water_meter == null) { return null }

// construct the edit parameter, only fill it if meter got replaced
var edit = []
if($feature.New_MeterID != water_meter.MeterID) {
  Push(edit, {
    "className": "test.DBO.WaterMeterTEST"
    "updates": [{"globalID": water_meter.GlobalID, "attributes": {"MeterID": $feature.MeterID}}]
  })
}

// return
return {
  "result": {
    "attributes": {
      "Old_MeterID": water_meter.MeterID,
// you can also copy the other fields here:
//      "Brand": water_meter.Brand,
//      "LatestReading": water_meter.LatestReading,
    }
  },
  "edit": edit
}&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 08 Feb 2022 14:29:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141583#M316</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-02-08T14:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to actively transfer data from a related table to it’s parent feature class and vice versa</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141592#M317</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;I really appreciate the help! I will give this a go once our field crew signs off for the day.&lt;/P&gt;&lt;P&gt;You have a great day as well!&lt;/P&gt;&lt;P&gt;-Terry&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 14:45:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141592#M317</guid>
      <dc:creator>Terry_Bearb</dc:creator>
      <dc:date>2022-02-08T14:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to actively transfer data from a related table to it’s parent feature class and vice versa</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141880#M318</link>
      <description>&lt;P&gt;I am unfortunately still having negative results getting any value to update in the parent feature class. After adding the attribute rule / publishing, when I access the web map again I am now receiving an error when I attempt to create the related record (see attached). I also took a screenshot my settings used for the attribute rule in Pro.&lt;/P&gt;&lt;P&gt;Attribute rule applied:&lt;/P&gt;&lt;P&gt;var water_meter = First(FeatureSetByRelationshipName($feature, "test.DBO.WaterMeterTOWorkHistory_TEST"))&lt;BR /&gt;if(water_meter == null) { return null }&lt;BR /&gt;var edit = []&lt;BR /&gt;if($feature.New_MeterId != water_meter.Meter_ID) {&lt;BR /&gt;Push(edit, {&lt;BR /&gt;"className": "test.DBO.WaterMeterTEST",&lt;BR /&gt;"updates": [{"globalID": water_meter.GlobalID, "attributes": {"Meter_ID": $feature.New_MeterId}}]&lt;BR /&gt;})&lt;BR /&gt;}&lt;BR /&gt;return {&lt;BR /&gt;"result": {&lt;BR /&gt;"attributes": {&lt;BR /&gt;"Old_MeterId": water_meter.Meter_ID,&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;"edit": edit&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tbearb_0-1644359056716.png" style="width: 171px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33418i5BEECD482FAE7D79/image-dimensions/171x179?v=v2" width="171" height="179" role="button" title="tbearb_0-1644359056716.png" alt="tbearb_0-1644359056716.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tbearb_1-1644359336187.png" style="width: 198px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33423i7A8B1348635CD57A/image-dimensions/198x150?v=v2" width="198" height="150" role="button" title="tbearb_1-1644359336187.png" alt="tbearb_1-1644359336187.png" /&gt;&lt;/span&gt;&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;</description>
      <pubDate>Tue, 08 Feb 2022 22:29:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141880#M318</guid>
      <dc:creator>Terry_Bearb</dc:creator>
      <dc:date>2022-02-08T22:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to actively transfer data from a related table to it’s parent feature class and vice versa</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141980#M319</link>
      <description>&lt;P&gt;Oh yeah, "Exclude from application evaluation" has to be checked for rules that affect other tables.&lt;/P&gt;&lt;P&gt;Try inserting a record in Pro before publishing, that will give better error messages.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 06:40:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1141980#M319</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-02-09T06:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to actively transfer data from a related table to it’s parent feature class and vice versa</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1142076#M320</link>
      <description>&lt;P&gt;Good morning. I went ahead and made sure the "Exclude from application evaluation" box was checked but I am still unfortunately seeing the same results. Attached are the error messages I have received within Pro. Again, thank you for your help.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tbearb_0-1644414089309.png" style="width: 258px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33479i34740ADF49B6FB03/image-dimensions/258x167?v=v2" width="258" height="167" role="button" title="tbearb_0-1644414089309.png" alt="tbearb_0-1644414089309.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tbearb_1-1644414126655.png" style="width: 262px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33480i9826A1A5EA503053/image-dimensions/262x179?v=v2" width="262" height="179" role="button" title="tbearb_1-1644414126655.png" alt="tbearb_1-1644414126655.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 13:42:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1142076#M320</guid>
      <dc:creator>Terry_Bearb</dc:creator>
      <dc:date>2022-02-09T13:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to actively transfer data from a related table to it’s parent feature class and vice versa</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1142876#M322</link>
      <description>&lt;P&gt;I haven't had much success with placing the attribute rule on the related table to update the feature class. Just out of pure curiosity, I placed an attribute rule on the parent feature class with the following settings / expression.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Field: Meter_ID&lt;/P&gt;&lt;P&gt;Trigger: Insert / Update&lt;/P&gt;&lt;P&gt;var WM = FeatureSetByName($datastore, 'waterutilities.DBO.WorkHistoryTEST');&lt;BR /&gt;var water_meter = First(FeatureSetByRelationshipName($feature, "waterutilities.DBO.WaterMeterTOWorkHistory_TEST"))&lt;BR /&gt;var globalid = $feature.globalid&lt;BR /&gt;var filterStatement = 'Related_Asset = @globalid'&lt;BR /&gt;var related_data = Filter(WM, filterStatement)&lt;BR /&gt;var cnt = Count(related_data);&lt;/P&gt;&lt;P&gt;var results = "";&lt;/P&gt;&lt;P&gt;if ((cnt &amp;gt; 0) &amp;amp;&amp;amp; (water_meter.Issue == 'MR')) {&lt;BR /&gt;for (var row in related_data) {&lt;BR /&gt;var line = row.New_MeterId;&lt;BR /&gt;results +=line;&lt;BR /&gt;}&lt;BR /&gt;} else {&lt;BR /&gt;results = "No related record";&lt;BR /&gt;}&lt;BR /&gt;return results;&lt;/P&gt;&lt;P&gt;The new Meter_ID is placed in the field on the FC (from the related table) after the record is created, but is appending the Meter_ID to whatever was previously there with each new record that is added. So, Meter ID of 7777 then becomes 77778888 when a new related record is added and then becomes 777788889999 when another record is added. Rather than just 8888 or 9999. Any ideas why?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 22:01:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1142876#M322</guid>
      <dc:creator>Terry_Bearb</dc:creator>
      <dc:date>2022-02-10T22:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to actively transfer data from a related table to it’s parent feature class and vice versa</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1143005#M323</link>
      <description>&lt;P&gt;The first error comes from me not testing the rule. When no relates asset is found, the rule should just return, not return null.&lt;/P&gt;&lt;P&gt;Second error: no idea.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I built a rudimentary structure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Feature class:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1644576015562.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33676iC5B974631924278E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_0-1644576015562.png" alt="JohannesLindner_0-1644576015562.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Table:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_1-1644576060877.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33677iEAA6D61CB87C4AC8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_1-1644576060877.png" alt="JohannesLindner_1-1644576060877.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Relationship class:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_2-1644576171269.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33678iA8732A644645267A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_2-1644576171269.png" alt="JohannesLindner_2-1644576171269.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Attribute rule on the work table:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_3-1644576350988.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33679i529FD43DEEE5C7D8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_3-1644576350988.png" alt="JohannesLindner_3-1644576350988.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Calculation Attribute Rule on WaterMeterWorkHistory
// Triggers: Insert
// Exclude from application evaluation
// Copies old values from water meter t
// get the water meter
var water_meter = First(FeatureSetByRelationshipName($feature, "WaterMeterTOWorkHistory"))
if(water_meter == null) { return }

// get attributes from water_meter
var old_attributes = {
  "Old_MeterID": water_meter.Meter_ID,
  "Old_Brand": water_meter.Brand,
  "Old_Reading": water_meter.Latest_Reading,
}

// map the attribute names from the work table to the feature class
var update_attribute_map = [
  ["New_MeterID", "Meter_ID"],
  ["New_Brand", "Brand"],
  ["New_Reading", "Latest_Reading"],
]

// if the new attributes are filled in, add them to the edit request
var updated_attributes = Dictionary()
for(var i in update_attribute_map) {
  var work_att = update_attribute_map[i][0]
  var asset_att = update_attribute_map[i][1]
  var new_att = $feature[work_att]
  var old_att = water_meter[asset_att]
  if(!IsEmpty(new_att)) {
    updated_attributes[asset_att] = new_att
  }
}
var edit = [{"className": "WaterMeter", "updates": [{"globalID": water_meter.GlobalID, "attributes": updated_attributes}]}]

// return
return {
  "result": {"attributes": old_attributes},  // copy old attributes from water meter to work table
  "edit": edit                               // copy new attributes from work table to water meter
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WaterMeter:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_4-1644577709593.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33683i9224DB9352AED72E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_4-1644577709593.png" alt="JohannesLindner_4-1644577709593.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;WaterMeterWorkHistory:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_5-1644578244677.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33684iACA529ADB7A2F2C0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_5-1644578244677.png" alt="JohannesLindner_5-1644578244677.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WaterMeter after these changes:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_6-1644578286865.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33685iFB8EED2176781445/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_6-1644578286865.png" alt="JohannesLindner_6-1644578286865.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 11:18:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1143005#M323</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-02-11T11:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to actively transfer data from a related table to it’s parent feature class and vice versa</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1143006#M324</link>
      <description>&lt;P&gt;It's because of this line:&amp;nbsp;&lt;STRONG&gt;results +=line&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;What your code does is:&amp;nbsp; go through ALL related work records and concatenate their New_MeterIDs. You need some way to check only the LATEST work record.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You shouldn't need the filter, as the FeatureSetByRelationshipName function returns only the related work records.&lt;/P&gt;&lt;P&gt;Note that, while this is absolutely a legit way of copying the new Meter_ID to the feature class, this won't happen automatically. You have to update the WaterMeter after you added a new WaterMeterWorkHistory record.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 11:23:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1143006#M324</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-02-11T11:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to actively transfer data from a related table to it’s parent feature class and vice versa</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1143047#M325</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;I really appreciate all the help you have given me thus far! I am admittedly new to arcade expressions / attribute rules so your assistance is really helpful. I hate to be nuisance, but for whatever reason it keeps telling me the fields in the first index [0] cannot be found for the $feature work history table. Everything appears to be set up correctly. From what I can tell, the fields are able to be found in the second index [1] water_meter FC.&lt;/P&gt;&lt;P&gt;Field "New_MeterId" cannot be found&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tbearb_0-1644590708141.png" style="width: 325px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33691i49BD3F3964C2709E/image-dimensions/325x222?v=v2" width="325" height="222" role="button" title="tbearb_0-1644590708141.png" alt="tbearb_0-1644590708141.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Work History table fields&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tbearb_1-1644590855548.png" style="width: 323px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33692iFD3B8C4A2AB5225F/image-dimensions/323x248?v=v2" width="323" height="248" role="button" title="tbearb_1-1644590855548.png" alt="tbearb_1-1644590855548.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Water Meter FC fields&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tbearb_2-1644590961077.png" style="width: 283px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/33693i5EDD30662F3250E9/image-dimensions/283x352?v=v2" width="283" height="352" role="button" title="tbearb_2-1644590961077.png" alt="tbearb_2-1644590961077.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 14:50:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1143047#M325</guid>
      <dc:creator>Terry_Bearb</dc:creator>
      <dc:date>2022-02-11T14:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to actively transfer data from a related table to it’s parent feature class and vice versa</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1146088#M331</link>
      <description>&lt;P&gt;Hey! Busy week, sorry for ghosting you...&lt;/P&gt;&lt;P&gt;Sadly, I can't really help you here. The fields seem to be fine.&lt;/P&gt;&lt;P&gt;My only suggestion would be to rebuild the two tables in a test gdb and try it again, mabe there's some interference from other rules (or something else, idk).&lt;/P&gt;</description>
      <pubDate>Mon, 21 Feb 2022 07:57:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1146088#M331</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-02-21T07:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to actively transfer data from a related table to it’s parent feature class and vice versa</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1152999#M342</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;&amp;nbsp;I just wanted to reach back out to you as a follow up and say that I finally have the expression working for me! Posted below is what ended up working for me where I had to specifically call out the field I wanted to use for the update. I then just applied the expression to individual fields when I set up the rule. I want to thank you for all your help and getting me on the correct path, it is really appreciated!&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Calculation Attribute Rule on WaterMeterWorkHistory table
// Triggers: Insert, Update
// Execution: Exclude from application evaluation
// Field: New_MeterId&lt;/LI-CODE&gt;&lt;LI-CODE lang="c"&gt;var water_meter = First(FeatureSetByRelationshipName($feature, "WaterMeterTOWorkHistory"))
if($originalfeature.New_MeterId == $feature.New_MeterId) { return null }

// get attributes from water_meter
var old_attributes = {
  "Meter_ID": water_meter.Meter_ID
}

// map the attribute names from the work table to the feature class
var update_attribute_map = [
  ["New_MeterId", "Meter_ID"]
]

// if the new attributes are filled in, add them to the edit request
var updated_attributes = Dictionary()
for(var i in update_attribute_map) {
  var work_att = update_attribute_map[i][0]
  var asset_att = update_attribute_map[i][1]
  var new_att = $feature.New_MeterId
  var old_att = water_meter[asset_att]
  if(!IsEmpty(new_att)) {
    updated_attributes[asset_att] = new_att
  }
}
var edit = [{"className": "WaterMeter", "updates": [{"globalID": water_meter.GlobalID, "attributes": updated_attributes}]}]

return {
  "edit": edit
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2022 17:26:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1152999#M342</guid>
      <dc:creator>Terry_Bearb</dc:creator>
      <dc:date>2022-03-11T17:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to actively transfer data from a related table to it’s parent feature class and vice versa</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1189663#M455</link>
      <description>&lt;P&gt;This is awesome and it worked for me! However, I'm unable to get it to work with ArcGIS Online nor Field Maps. Any suggestions?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 23:18:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1189663#M455</guid>
      <dc:creator>dommybo123</dc:creator>
      <dc:date>2022-07-05T23:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to actively transfer data from a related table to it’s parent feature class and vice versa</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1189842#M456</link>
      <description>&lt;P&gt;That's great, glad to hear you were able to use this as well! I have it currently working in Field Maps. What is the error you're receiving?&lt;/P&gt;&lt;P&gt;If it is working as it should in ArcGIS Pro, but in Field Maps you receive an "Arcade expression is invalid" error when you attempt to edit, it could be the version of Field Maps that is causing the issue. Ever since the 22.2.0 version was released, there have been issues when attribute rules are implemented. The temporary work around at least for that error was to make sure you &lt;SPAN&gt;checked "Exclude from Application Evaluation" for all the attribute rules in Pro and then re-publish the service.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 13:52:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1189842#M456</guid>
      <dc:creator>Terry_Bearb</dc:creator>
      <dc:date>2022-07-06T13:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute rule to actively transfer data from a related table to it’s parent feature class and vice versa</title>
      <link>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1189952#M458</link>
      <description>&lt;P&gt;That's really interesting. I'm actually not receiving any error message, it's simply that when I add a new related record on field maps, it's not autopopulating the respective attributes in the feature class like it does in ArcGIS Pro. I checked "Exclude from Application Evaluation" when I initially made the rule, so I don't believe that's the issue. And it's an online map, so I don't need to manually sync it. I have Field Maps version 22.3.0, and ArcGIS 2.9.3. In another thread, someone said that FeatureSetByRelationshipName has some bugs, but I don't know of any other ways to rewrite your code. Let me know if you have any other suggestions. I appreciate the help and I'm glad it's working for you!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 16:10:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/attribute-rules-questions/attribute-rule-to-actively-transfer-data-from-a/m-p/1189952#M458</guid>
      <dc:creator>dommybo123</dc:creator>
      <dc:date>2022-07-06T16:10:27Z</dc:date>
    </item>
  </channel>
</rss>

