Update attribute on intersected feature

439
3
09-20-2022 03:21 PM
RhettZufelt
MVP Frequent Contributor

I have a line featureclass and a point featureclass in same map.

If I add/edit a point, it is pretty easy to find the nearest/intersecting line and extract a value from the table and update a point field with it. (I.e., copy the "ID" field from the line layer to a "LineID" field in the point layer).

However, is is possible to go the other way?  I would like to copy the value in the point layer field "Status" to the the "PointStatus" field in the intersecting line feature.

Is this possible with calculated expressions in Field Maps? 

 

Thanks,

R_

 

 

0 Kudos
3 Replies
JohannesLindner
MVP Frequent Contributor

It is possible, at least in Attribute Rules, I suspect you can do it in Field Maps, too.

Instead of returning a value, you can return a dictionary that follows a certain schema:

Attribute rule dictionary keywords—ArcGIS Pro | Documentation

var lines = FeaturesetByName($datastore, "LineFeatureclass", ["OBJECTID"], false)
var i_line = First(Intersects($feature, lines))
if(i_line == null) { return null }
return {
    //result: {attributes: {TextField: "value"}},
    edit: [{
        className: "LineFeatureclass",
        updates: [{objectID: i_line.OBJECTID, attributes: {PointStatus: $feature.Status}}]
    }]
}

 

 


Have a great day!
Johannes
0 Kudos
RhettZufelt
MVP Frequent Contributor

Thanks Johannes,

Don't believe the calculated expressions work with this as it has to be tied to a particular field, and doesn't seem to honor the edit: dictionary.  

Was thinking of using attribute rules, but am very confused about what/where/when attribute rules will work in Field Maps.

Lots of post saying it is working just fine, but I can't get even the basic attribute rule (populate a field with a static text value) to work in AGOL and/or Field Maps.

My rule works just fine in Pro 2.9.3, but if I publish to AGOL, doesn't seem to work with anything.

Trying to figure out what version of Pro/SDE/WebMap/FieldMaps/etc. that support attribute rules, but not making much progress.  Suspect my rules are not propagating to AGOL hosted features as I am using older version of database to publish the features from.

Hopefully, I can find a listing somewhere of software/versions required to make attribute rules work in AGOL, but haven't narrowed it down yet.

Thanks again,

R_

 

 

 

0 Kudos
JohannesLindner
MVP Frequent Contributor

AFAIK, AGOL doesn't support Attribute Rules, yet. You could try publishing to Portal, if you have one.


Have a great day!
Johannes
0 Kudos