General Info
Current Attempt
1 var intersectLayer =Intersects(FeatureSetByName($map,"basin"), $feature)
2 for (var f in intersectLayer){
3 return f.FID
4 }
Intersection(FeatureSetByName($map,"basin"), $feature)
Sorry to rain on your parade, but the Visualization Arcade Profile does not even support accessing other features in the same layer, let alone features in a separate layer in your map. You can only reference a feature's own attributes and the current $view.scale for visualization.
That's not to say that this isn't possible, however. Do you have ownership or editing rights over the National Dam Inventory layer? There are a couple of ways you might do this, but they rely on either being able to create a view layer or add a new field.
I'm relatively new to Arcade so I'm not sure what it's limitations are. I was able add the FID# from the basin layer (polygon) to the attribute table of the dams (points) that intersect it using the attribute expression (see image below). At this stage only the the dams that I want to show have the "1" in the "filter" field. I was hoping to use this to have different symbology between the points in and out of the polygon or to filter out the points outside of the polygon altogether. Are you saying this last step is not possible? Unfortunately I don't have ownership/editing rights for the layer. Thanks @jcarlson.
Just to clarify: is that "Filter" field pictured just coming from a pop-up expression, or is it a real field that was created with Field Calculate or something? When you say that you were able to "add the FID" from the basins, are you referring to the Arcade expression in your original post, or have you actually performed a spatial join?
The symbology settings in a web map can only reference a real field in the table, or an expression. If it's an expression, the expression itself can only reference other attributes in the same row of the table.
Thanks jcarlson. I see what you're saying now. The "FID" was added using the Arcade expression in the original post. No spatial join or field calculation was done. That's a bummer. I had really hoped that there was a way to spatially filter a web service down to an area of interest without breaking the link to the service.