ArcGIS Online

What’s New in Arcade 1.8

Arcade 1.8 has been released as part of the recent ArcGIS Online update, bringing new functions to try.  The theme of this release is convenience; the new functions allow you do things that were already possible with Arcade, but can now be done in a more scalable, efficient and intuitive way.  Let’s take a look.

Relationships get easier


With the introduction of FeatureSets, it has been possible to leverage information from related records in your pop-ups. However, doing so was a bit cumbersome and unless you were very familiar with Arcade you might have missed it.  Now in Arcade, you can directly use relationships, making it easier to work with related records.  The new function is FeatureSetByRelationshipName(); it’s a bit of a mouthful, but pretty handy.   This new FeatureSet function works by taking a feature and a relationship class name (don’t worry, you don’t have to write it out; the Arcade Editor does the work for you from the Globals tab) and returning you the related features as a FeatureSet. From there, you can work with it as needed.


video showing where to find the new relationship function

This function is available when performing field calculations and configuring pop-ups.  The example below shows how to find the total number of measurements for a given water well in California.

Try adding the expression below into the water wells layer in the following map:

return Count(FeatureSetByRelationshipName($feature,"GroundwaterStations_GroundwaterMeasures"));

Understanding your data

When layers contain a large number of features, it can be more useful to summarize data instead of showing information on individual features. This is the case with the following Urban Forestry map for Toronto.  The GroupBy() function and updated Distinct() function help make that easier and faster.


In the example below, we use the GroupBy() function to identify the three most popular tree species in each neighborhood in Toronto. Add the following to the pop-up for the Toronto neighborhoods layer:

var intersectArea = Intersects(FeatureSetByName($map,"Urban Forestry"), $feature);
var treeList = groupBy(intersectArea, "COMMON_NAM",
                {name:"count", expression:"COMMON_NAM" , statistic:"COUNT"});
var topFeatures = Top(OrderBy(treeList, "count DSC"),3);
var treeList = '';
for (var topFeature in topFeatures) {    
    treeList += topFeature.COMMON_NAM + " (" + topFeature.count + ")" + TextFormatting.NewLine;
return treeList;   


Image showing a pop up

Bonus Challenge: How would you add in the average tree diameter for each species?



Distinct() previously only worked with arrays, but it can now be used to get a unique set of values based on a FeatureSet and a field. Using the same map as above, we can quickly get a list of all of the unique species within a given neighborhood.  Given the diversity of the tree species in Toronto, that list might be a quite long, but I’m sure you get the idea.

var intersectArea = Intersects(FeatureSetByName($map,"Urban_Forestry"), $feature);
var uniqueTreeList = Distinct(intersectArea, "COMMON_NAM");

var treeList = '';
for (var tree in uniqueTreeList) {
    treeList += tree.COMMON_NAM  + TextFormatting.NewLine;
return treeList;

Bonus challenge: Could you modify the expression above to only list distinct maple trees?



Being able to measure the distance between two points easily has been a big request. Find the World Cities layer in the ArcGIS Living Atlas of the World and add the following expression to add the geodetic distance from any city to its National capital.

var filterCriteria = "National and provincial capital";
var filterCriteria2 = "National capital";
var featureCountry = $feature["CNTRY_NAME"];
var distToCapital = FeatureSetByName($datastore,"World_Cities");
var pointCapital = First(Filter(distToCapital,"(STATUS = @filterCriteria OR STATUS = @filterCriteria2) AND CNTRY_NAME = @featureCountry "));

return $feature["CITY_NAME"] + " is in the country of " +
$feature["CNTRY_NAME"] + " and is " + 
Round(DistanceGeodetic($feature, pointCapital, "kilometers"),2) + 
" km away from its capital " + pointCapital.CITY_NAME;


picture of finished pop up

Bonus Challenge: Try changing this expression to say something different when the city you click on is the National Capital?

Enriching your data on the fly


Many of you have asked for the ability to pull information from a layer that isn’t in your map into another layer’s pop-up, to avoid cluttering up the Contents pane with layers you don’t want the users of your map to interact with.  Good news! We’ve extended support for the function FeatureSetByPortalItem() to the pop-up profile, allowing you to do just that. This functionality really shines when you want to take advantage of all the rich data available to you through the Living Atlas but don’t necessarily want the layers in your map.  Since using this function with the Living Atlas is going to be the subject of a future blog article (stay tuned), let’s go back to the Urban Forestry example above.  Recreate the Arcade expression, but this time without the tree layer in the map. Remove the layer from the map and update your existing expression to:

var portal = Portal("")
var intersectArea = Intersects(FeatureSetByPortalItem(portal,"62ee1a67f143432bb130f80efe5e6adc", 0),$feature);
var uniqueTreeList = Distinct(intersectArea, "COMMON_NAM");
var treeList = ''
for (var tree in uniqueTreeList) {    
    treeList += tree.COMMON_NAM  + TextFormatting.NewLine;    
return treeList;   

And you no longer need the tree layer in your map.

Some final thoughts

Arcade 1.8 is available in ArcGIS Online today and will be coming to ArcGIS Enterprise, ArcGIS Pro and mobile field apps in subsequent releases.  You can find lots of great resources in the Arcade documentation, and don’t forget to check our expression repository and contribute your own great ideas.

About the author

Product Engineer for ArcGIS Online and technology enthusiast.


Next Article

Mind the map: a new design for the London Underground map

Read this article