Select to view content in your preferred language

ArcGIS Pro Arcade Expression Error

134
3
Jump to solution
a week ago
LynetteSmith
New Contributor

Using ArcGIS Pro 3.3.1

Could someone tell me what is wrong with the expression, please. I am trying to use contains or possibly use intersects to bring back the zip in an attribute field when an address is being added in the database. The zip boundaries are on the sde. and I am wanting it to recognize the ZIP field in that data.

Error I am getting

LynetteSmith_1-1726678621289.png

 

 

 

 

 

0 Kudos
1 Solution

Accepted Solutions
Robert_LeClair
Esri Notable Contributor

Using ArcGIS Pro attribute rules you can do this rather easily - see an example here - Solved: Using Attribute Rules to calculate fields from int... - Esri Community

View solution in original post

3 Replies
jcarlson
MVP Esteemed Contributor

Quite a few things, really.

  1. The Polygon function just creates a single polygon from a text-based definition, it won't work with an entire datastore
  2. To get a layer by name out of the datastore, you have to use the function FeatureSetByName.

There are other issues as well, but honestly, just throw that whole expression out. To intersect with another layer, you need to get the other layer as a FeatureSet, and you also need to reference an individual feature for the intersection.

It might look something like this:

// zip polygons
var zips = FeatureSetByName($datastore, 'ZIP_CODE_BOUNDARIES', ['ZIP'], true)

// intersect
var xs_zips = Intersects($feature, zips)

// grab the first intersected feature
var the_zip = First(xs_zips)

// return the zip of that feature
return the_zip['ZIP']
- Josh Carlson
Kendall County GIS
Robert_LeClair
Esri Notable Contributor

Using ArcGIS Pro attribute rules you can do this rather easily - see an example here - Solved: Using Attribute Rules to calculate fields from int... - Esri Community

LynetteSmith
New Contributor

Thank you for sending me to the helpful information.

I was able to get it to work using the below expression.

LynetteSmith_0-1727360317515.png

 

0 Kudos