I am trying to customize the pop-up of a polygon layer in ArcGIS Pro with an arcade expression. I am working on a request to change inspection boundaries to transfer about 200 inspections from one district to another, so I want to create an expression that will show me how many inspection points intersect each district. I successfully used the following code in the Arcade Playground:
var parcels = FeatureSetByName($map, "Parcels_And_Buildings - Tax Parcels") var parcelIntersect = Intersects($feature, parcels) var parcelCount = Count(parcelIntersect) return parcelCount
However, when I tried to add it as an expression for the pop-up of the inspection layer (with appropriate adaptations), I got the message "Invalid expression. Error on line 3. General function failure."
Going off of the message, it sounds like there is a problem with the count function. (I had originally nested the functions inside each other and then separated them to try to isolate the problem.) Has anybody else had a problem like this that they were able to solve? Could it be because there are roughly 600 points intersecting the polygon?
I also selected one of the districts and then tried doing a select by location on the points for the selected district. By comparing the results to what I got in ArcMap, I think it selected all the right points, but for some reason, the highlights are all over the place. It's really odd, because when I tell it to zoom to the selection, it zooms in to the selected district, but it doesn't show any of the points as being highlighted anymore.
I am on version 2.7, and I checked to make sure that I have the most current version. The points are being pulled from a SQL view. I am still adjusting to Pro. I've been trying to switch over, but if I can't get these issues straightened out, I guess I'll have to go back to ArcMap for this project.
Are these layers coming from a hosted feature service?
When I attempt a similar expression with features hosted in my own portal / server, I get a network error at the point in my expression when I call the Count function.
When attempting with file-based feature classes, however, the expression evaluates fine.
Perhaps someone on ESRI staff can confirm, but I would guess that there is a mismatch between what the Count function does in 2.7 and what prior portal versions do, such that the command cannot return successfully.
The layers I'm using are not services. The district polygons are coming from a file geodatabase, and the points are coming straight from a SQL database.
Hi @DeniseBeckham ,
The only reason I can come up with to have this type of selection behavior would be multi point features. If possible could you export a selection of the SQL database point to a local FGDB and try if it provides the same selection result?
There aren't any multipoint features in this layer. It's coming from a view that our programmer made that pulls from about 5 different tables. The locations are created from the lat/long values in one of the tables.
As you suggested, I selected some of the points and exported them. I selected a rectangle on the map, and the highlights were all over the place again.
However, when I exported them into the project geodatabase, all the points in the resulting feature class were within the rectangle I drew. And when I selected by location from my export, the highlights also showed up properly.
Furthermore, I just tried my arcade expression again. I changed it to reference the points I exported, and it worked perfectly! I'm now really confused as to why it won't work with the live data. I'd hate to have to export all the points every time I want to use arcade expressions when I'm working with SQL data in Pro. The view is a little slow. Could that have something to do with it?
Double check the view query, if you have access to the SQL behind it. It sounds like maybe it doesn't a consistent unique identifier column to reference, so when it selects "ObjectID 100", there might be multiple that it's grabbing by mistake.
If you have access to the database, you could also add the points as a Query Layer so that Pro can validate the SQL beforehand, and select multiple columns as unique identifiers.
When you export those features, it would have created its own internal ObjectID to uniquely identify rows in the exported feature class, which might explain the difference.
I do have access to the SQL database. The layer in Pro uses the RECORD_ID field (which is a string of two letters followed by 7 numbers) as the unique identifier column. I did a few different simple queries of the view in SQL and confirmed that the Record IDs are definitely unique in this view.
I also tried adding a new query layer from the Add Data button on the ribbon and selected fewer columns. I made sure to choose the RECORD_ID column as the unique identifier, but the new layer exhibited the same unexpected highlighting behavior and the arcade expression didn't work when I referenced the new layer. As I mentioned earlier, select by location works perfectly fine on the exact same view in ArcMap.