Attribute Rule sample for cascading update from Record to Parcel Type?

470
2
06-21-2022 11:37 AM
Labels (1)
PascalVezina
Occasional Contributor II

Good day,

Can we see an example of a "Cascading" update from the Record to a parcel type using an Attribute Rule?

All the current Arcade samples are simple.

How do you transfer a value from a field in the Record table (parent) to the same field in the Parcel Type (i.e. Land_Parcel_Lines with the same CreatedByRecord as the record) when the "Record" is inserted or updated. It's a "calculation" rule I presume?

Thank you,

2 Replies
DrewDowling
Occasional Contributor III

you can use the "edit" key word in a calculation rule to update other feature classes. Excellent intro blog here. The bit I find tricky to get the names of the tables right. Here is  the documentation

AmirBar-Maor
Esri Regular Contributor

@PascalVezina 

It's great to see you make strides in Arcade and thank you @DrewDowling for sharing the link to Husseins' blog. 

Here is an example of updating a line geometry based on a point location: https://community.esri.com/t5/arcgis-parcel-fabric-blog/using-attribute-rules-to-update-the-line-geo...

 

Another example (that had a scalability issue) is where an update to a smaller US PLSS 'intersected' polygon updates a section by selecting and dissolving all other 'intersected building blocks'.

 

This is the expression used

var twpNo = $feature.TWNSHPNO
var twpDir = $feature.TWNSHPDIR
var rangeNo = $feature.RANGENO
var rangeDir = $feature.RANGEDIR
var sectionNo =$feature.FRSTDIVNO

//The attribute rule is added to the Intersected polygon class on the FRSTDIVNO field on update

//select all other intersected polygons that belong to the same section

//construct a sql query for intersected and sections
var sql = "TWNSHPNO = '" + twpNo + "' And TWNSHPDIR = '" + twpDir + "' And RANGENO = '" + rangeNo + "' And RANGEDIR = '" + rangeDir + "' And FRSTDIVNO = '" + sectionNo + "'";

//dissolve all intersected polygons in the section to get a polygon geometry
var fields = ['TWNSHPNO','TWNSHPDIR','RANGENO','RANGEDIR','FRSTDIVNO', 'GlobalID'];
var intersected = FeatureSetbyName($datastore, "Intersected",fields, true);
var fsIntersected = Filter(intersected,sql);

var SectionGeometry = Geometry($feature);
for (var interPoly in fsIntersected){
    SectionGeometry = Union(SectionGeometry, Geometry(interPoly));
}

//find the corresponding section geometry feature
var sections = FeatureSetbyName($datastore, "Sections",fields, true);
var fsSections = Filter(sections,sql);

//get the section row (we should only have one )
var sectionToUpdate = first(fsSections);
var sectionGlobalID = sectionToUpdate.GlobalID;

return {
      //we want to just return the value of field `FRSTDIVNO` no change require
      "result": $feature.Field,
      //this keyword indicates an edit that need to happen, its an array since we can make many edits
       "edit": [
           {  
              //the other class we want to edit
               "className" : "Sections",
               //the type of edit, in this case we want to update so we say `updates`, its an array since we can make many updates
               "updates" : [
                      { 
                            //what feature we need to update? we can either find it by the globalid or the objectId
                            "globalID" : sectionToUpdate.GlobalID,
                            //what do we want to update (we can optionally add attributes property and update properties there)
                            "geometry": sectionGeometry

                     }
             ]
            }    
     ]
}

 

Once you have a your expression working, please share.

0 Kudos