Select to view content in your preferred language

Attribute Rules: Update Attributes

4374
16
09-16-2020 01:42 PM
by Anonymous User
Not applicable

I have old features that I am adding via copy and paste to a current production feature class that has attribute rules enabled. I am having trouble figuring out a way to update "at will" specific fields that are null for the old features being brought in.

The attribute rule for the current feature populates point data fields with data from a polygon boundary vi INTERSECT, but when I perform the copy and past the fields remain null and are not updated via the attribute rule. 

I know with attribute assistant you can "Run Change Rules for Selected Features" is there a simple way to do this with attribute rules or mimics the rule using ARCADE or Python in the field calculator as I attempted below?

0 Kudos
16 Replies
by Anonymous User
Not applicable

Xander Bakker‌,

Ahhhhh I now get why it is important to format my ARCADE syntax using VAR and not just throwing together a sandwich of functions. They are not one in the same but different 

The Fireman/???????/Giant – Twin Peaks: Part 17 & Part 18 – Twin Peaks &  David Lynch Discussion

I am learning to overcome this type of bad habit in Python scripting & expressions, so thank you for your critique!

by Anonymous User
Not applicable

Xander Bakker‌,

Am attempting you continue the task and am running into this error.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi Brian.Acheff ;

The error you are receiving may be caused by not having a result in the intersection. Can you try this?

// don't do any intersects if you are not going to use it
if (IsEmpty($feature.MACOD_ID)) {
    // intersect the data (don't retrieve the geometry when you don't need it)
    var fs = Intersects(FeatureSetByName($datastore, "MACOG_Intersections_Poly", ["MACOG_ID"], False), $feature);
    // count the resulting features
    var cnt = Count(fs);
    // don't try and access the first feature if there are no features
    if (cnt > 0) {
        // get the first feature and return the MACOG_ID
        var feat = First(fs);
        return feat["MACOG_ID"];
    }
}‍‍‍‍‍‍‍‍‍‍‍‍‍
JoeBorgione
MVP Emeritus

For intersecting underlying features, that's what works for me.

That should just about do it....
0 Kudos
by Anonymous User
Not applicable

Xander Bakker‌,

It checks out, but returns Null

0 Kudos
MikeMillerGIS
Esri Frequent Contributor

If you have applied the attribute rule to the class, and it is set for update, you can trigger an update by simply calc'ing a field to itself.  

JoeBorgione
MVP Emeritus

That's a cool trick.  Thanks Michael Miller!

That should just about do it....
0 Kudos