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.
Solved! Go to Solution.
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").
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
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
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").
Thank you 👍