Select to view content in your preferred language

How do I reference a layer in my TOC in an Arcade Expression in Pro for symbology

3272
1
Jump to solution
12-20-2021 01:43 PM
LoriEmerson_McCormack
Regular Contributor

The Arcade expression below works in ArcGIS Online.  How do I get the Arcade expression to work in ArcGIS Pro before publishing my map service map to be used in ArcGIS API for JavaScript?  I get an error saying "Invalid expression.  Error on line 2.  Object not found $map)."  I also tried $datastore instead of $map.  When I use $datastore, do I need to list the entire path to the feature class?

I am trying to find the max RatingDate for each RoadID, so the symbology displays the PSC for the most current rating date.

var currentFeatureRoadID = $feature.RoadID
var featuresSurfCond = FeatureSetByName($map,'Surface Condition', ['RoadID', 'RatingDate', 'PSC'], true);
var featuresSurfCondFilter = Filter(featuresSurfCond, 'RoadID = @currentFeatureRoadID')
var maxRatingDate = max(featuresSurfCondFilter, 'RatingDate')
if ($feature.RatingDate == maxRatingDate) {
return $feature.PSC
}

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

The short answer: you don't!

Arcade has a number of different profiles, each with different capabilities. The symbology profile in particular does not allow accessing other layers, either in the datastore or the map.

- Josh Carlson
Kendall County GIS

View solution in original post

1 Reply
jcarlson
MVP Esteemed Contributor

The short answer: you don't!

Arcade has a number of different profiles, each with different capabilities. The symbology profile in particular does not allow accessing other layers, either in the datastore or the map.

- Josh Carlson
Kendall County GIS