Frequently Asked Questions
- Why Arcade?
- Where can I use Arcade?
- Which version of Arcade does my product or API use?
- Can Arcade be used to build standalone apps?
- How do I control the execution of Arcade?
- How do I create my own Arcade profiles?
- What is the $ character used for?
- Can I use Arcade outside the ArcGIS platform?
- Where can I use geometry functions?
- Can I use any function in any profile?
- How do I reference data from a joined table?
- How do I access data from related tables?
- Can I access data from other layers, web maps, or data sources?
- Where can I find examples of Arcade used in web apps?
- Where can I share my Arcade expressions with others?
- Can I use an Arcade expression outside script tags in a web app?
- Why doesn't my expression work in my web app, but it does in ArcGIS Online?
You may find yourself asking, "Why did Esri bother writing it's own language when it probably could have used others, like Python?"
This decision was made because we needed an expression language that met the following requirements:
- Lightweight and simple - A language with a small number of functions and an easy syntax
- Portable - A language that can execute in multiple environments with the same syntax for web, desktop, and mobile apps
- Secure - A language that doesn't have security vulnerabilities that open the door to malicious scripts
- Geospatial first - A language that makes geospatial functions and capabilities first-class citizens
Where can I use Arcade?
Arcade is an expression language intended for use solely within the ArcGIS platform. It is not a standalone language intended for building apps or for executing expressions within other apps not supported by ArcGIS. It can only be executed within the context of a designated profiles, such as labeling, visualization, popups, calculation, and constraints.
For example, Arcade can be used to calculate values client-side for the popup.
// displays the % change between two attributes for the popup var pop2020 = $feature.POP_2020; var pop2010 = $feature.POP_2010; var perChange = ( ( pop2020 - pop2010 ) / pop2010 ); // implicitly casts the number as a string return Round( perChange ) + "%";
See the Getting started with Arcade page and other guide pages to learn more about when you can use Arcade.
Which version of Arcade does my product or API use?
You can use the version matrix to find the Arcade version corresponding to the ArcGIS product you're using. See the release notes to view the features new to each release. The documentation of each function also indicates the Arcade version in which the function was added. If no version is specified, then the function was added in the initial
1.0 release of Arcade.
Can Arcade be used to build standalone apps?
How do I control the execution of Arcade?
Currently, you cannot execute Arcade expressions outside of a supported execution profile. If you have a use case for creating your own Arcade execution profile, then please send us feedback and describe in detail what you are trying to accomplish and how Arcade can help you.
How do I create my own Arcade profiles?
We currently don't document a way to create your own Arcade profiles. If you have a need for new Arcade profiles (or environments for executing Arcade), then please send us feedback and describe in detail what you are trying to accomplish and how a new Arcade profile can help you.
What is the
$ character used for?
The dollar sign
$ character prefixes all valid global variables in an Arcade profile. All profiles support the
$feature global, and some include the
$feature represents the feature currently executing the Arcade expression. You can reference attributes in the feature by using the
$feature.FieldName syntax and get its geometry using any geometry function.
// $feature gives you access to field values // so you can use them in calculations $feature.POPULATION / $feature.SQ_MILES; // Assume the $feature is a point geometry var featureGeometry = Geometry($feature); // returns the x-coordinate of the geometry featureGeometry.x
Can I use Arcade outside the ArcGIS platform?
No. Arcade may only be executed in a supported Arcade profile.
Where can I use geometry functions?
You can use geometry functions in any execution profile. However, you should be aware that since Arcade expressions execute for each feature, using multiple geometry operations within the context of some profiles, such as
visualization, can be expensive and severely impact the performance of the application. Therefore, it may be more advisable to reserve certain geometry operations for other cases, such as the
Can I use any function in any profile?
The majority of functions may be used in any profile, but not all functions are designed for all profiles.
Some functions are reserved for specific profile(s). The documentation for each function indicates the valid profiles where it may be used. If a target profile is not specified in the documentation, then you can assume that the function may be used in any profile.
How do I reference data from a joined table?
You can reference attribute data from a joined table using the square bracket syntax for referencing field names:
// data from a joined table var demVotes2016 = $feature["COUNTY_ID.VOTED_DEM_2016"]; var demVotes2012 = $feature["COUNTY_ID.VOTED_DEM_2012"]; // returns % change in votes from 2012 to 2016 Round( ( ( demVotes2016 - demVotes2012 ) / demVotes2012 ) * 100, 2);
How do I access data from related tables?
Currently, you cannot access data from related tables, other features in the same layer, features from other layers, web maps, or any other data source outside the feature executing the Arcade. However, this capability is coming in a future release.
Can I access data from other layers, web maps, or data sources?
No. You currently cannot access data from related tables, other features in the same layer, features from other layers, web maps, or any other data source outside the feature executing the Arcade. However, this capability is coming in a future release.
Where can I find examples of Arcade used in web apps?
You can find examples in the following places:
- ArcGIS Enterprise
- ArcGIS Blog
Where can I share my Arcade expressions with others?
You can publicly share Arcade expression templates with others in the Esri/arcade-expressions GitHub repository. This repository is intended for sharing and maintaining reuseable Arcade expressions across all supported profiles.
Can I use an Arcade expression outside script tags in a web app?
Why doesn't my expression work in my web app, but it does in ArcGIS Online?
Arcade expressions are portable as along as the functions used in the expression and the execution profile are supported in the versions of Arcade used by the apps sharing the same expression.
Another example is
$feature casting to
Geometry in geometry functions. In Arcade 1.4, the following expression is valid:
Area( $feature, "kilometers" )
But it is not valid in Arcade 1.3. Arcade 1.3 doesn't automatically cast a feature to a geometry, so you will need to cast the geometry yourself to ensure portability.
Area ( Geometry($feature), "kilometers" )
Also note that geometry functions weren't supported until Arcade 1.3, so neither of the expressions will work if you attempt to use them in an app that uses Arcade 1.2 or prior.
To ensure portability, you should try to use the latest version of Arcade as possible in each of your apps.
Feedback on this topic?