0

I am using ArcGIS Pro 2.5 and I am trying to calculate the sum of a field in Arcade. I used

Sum($layer, "Population") 

However when verifying I get the message that "Object Not Found $layer". I am wondering if the global $layer is available in ArcGIS Pro 2.5? enter image description here

1 Answer 1

1

Field Calculate Profile

I am assuming that you are using the Field Calculator based on your question.

$layer is certainly present in Pro 2.5, and is included in the Field Calculate profile of Arcade. The code you give in your post should work just fine, as pictured below. I used the Arcade Playground to test it.

According to the Esri docs, the current Field Calculate profile has been in place since Arcade v 1.5, which would have been back in Pro 2.3, so I don't think the Pro version is causing your problem.

field sum in arcade

Other Profiles

It's also possible you're not using the Field Calculator, but are trying to sum a field for use in another Arcade profile, such as generating popup content, symbology, or labels. In some cases, the $layer global is not accessible. You should refer to the other profiles in the doc link above to see which globals are available to your particular situation.

3
  • No, it seems it is not available in Pro 2.5.2. I tested it on 3 different systems. What you are showing is the Arcade Playground. It is available there [probably as part of AGO]. I am using field Calculator in ArcGIS Pro and it sends an error message that the $layer is not available. Commented Jul 27, 2020 at 21:44
  • That's very strange. I'm using 2.5.2 myself and it works just fine, and I have tested it there as well. What kind of data source are you using?
    – jcarlson
    Commented Jul 28, 2020 at 11:06
  • Thank you Josh for your response; I edited my question and added a screenshot of my Field Calculator. I updated Arc Pro to 2.6 as well. Can you show a screenshot of the field calculator on your machine and validate it? This is very strange it is not working here! Commented Jul 28, 2020 at 23:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.