Select to view content in your preferred language

Attribute Rules: Copy parcel number to address point when new address point created?

1024
4
Jump to solution
09-14-2022 04:39 PM
avonmoos
Regular Contributor

I need assistance building an expression which would copy the parcel number attribute from our parcel layer to the parcel attribute in our address point layer when creating a new one. This would be based on the parcel that the address point being created sits on.

0 Kudos
1 Solution

Accepted Solutions
JohannesLindner
MVP Frequent Contributor

Create a Calculation Attribute Rule for your point feature class (SiteAddress).

As field for the rule, choose "BaseParcel"

As triggers, choose "Insert".

As expression, use this:

var parcels = FeatureSetByName($datastore, "SurveyParcel", ["ParcelID"], false)
var intersecting_parcel = First(Intersects(parcels, $feature))
if(intersecting_parcel == null) {
    return null
}
return intersecting_parcel.ParcelID

 

This should work if you're working in a file geodatabase. If you work in an Enterprise geodatabase, you have to replace "SurveyParcel" in line 1 with the complete name of the feature class ("Databasename.Dataowner.SurveyParcel").


Have a great day!
Johannes

View solution in original post

4 Replies
JohannesLindner
MVP Frequent Contributor

As you're asking this in the ArcGIS Pro community, I'm assuming you mean Attribute Rules, not Assistant.

Introduction to attribute rules—ArcGIS Pro | Documentation

If you indeed mean Assistant, I'll move your question to the ArcMap community.

 

// Attribute Rule on the Address Points
// triggers: Insert

// load the parcels
var parcels = FeatureSetByName($datastore, "Databasename.Dataowner.Parcels", ["ParcelNumber"], false)

// intersect with the new point
var intersecting_parcel = First(Intersects(parcels, $feature))

// return null if no parcel was intersected
if(intersecting_parcel == null) {
    return null
}

// else return that parcel's number
return intersecting_parcel.ParcelNumber

Have a great day!
Johannes
avonmoos
Regular Contributor

Thank you for the quick response! I'm pretty green when it comes to Arcade, below are the features and fields I will be using. Where in your code do I place these in the variables?

$feature.SurveyParcel

 and the parcel ID field is called ParcelID

 

$feature.SiteAddress

and the parcel ID field is called BaseParcel

 

0 Kudos
JohannesLindner
MVP Frequent Contributor

Create a Calculation Attribute Rule for your point feature class (SiteAddress).

As field for the rule, choose "BaseParcel"

As triggers, choose "Insert".

As expression, use this:

var parcels = FeatureSetByName($datastore, "SurveyParcel", ["ParcelID"], false)
var intersecting_parcel = First(Intersects(parcels, $feature))
if(intersecting_parcel == null) {
    return null
}
return intersecting_parcel.ParcelID

 

This should work if you're working in a file geodatabase. If you work in an Enterprise geodatabase, you have to replace "SurveyParcel" in line 1 with the complete name of the feature class ("Databasename.Dataowner.SurveyParcel").


Have a great day!
Johannes
avonmoos
Regular Contributor

Thank you 👍

0 Kudos